#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

60 lines
1.4 KiB

// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.VB.Dom;
using NUnit.Framework;
namespace ICSharpCode.NRefactory.VB.Tests.Dom
{
[TestFixture]
public class SkipMethodBodiesTest
{
[Test]
public void EmptyMethods()
{
string txt = @"internal sealed class Lexer : AbstractLexer
{
public Lexer(TextReader reader) : base(reader)
{
}
void Method()
{
}
}";
Check(ParseUtilCSharp.ParseGlobal<TypeDeclaration>(txt, false, true));
}
[Test]
public void NonEmptyMethods()
{
string txt = @"internal sealed class Lexer : AbstractLexer
{
public Lexer(TextReader reader) : base(reader)
{
if (reader == null) {
throw new ArgumentNullException(""reader"");
}
}
void Method()
{
while(something) {
if (anything)
break;
}
}
}";
Check(ParseUtilCSharp.ParseGlobal<TypeDeclaration>(txt, false, true));
}
void Check(TypeDeclaration td)
{
Assert.AreEqual("Lexer", td.Name);
Assert.AreEqual(2, td.Children.Count);
Assert.AreEqual(0, ((ConstructorDeclaration)td.Children[0]).Body.Children.Count);
Assert.AreEqual(0, ((MethodDeclaration)td.Children[1]).Body.Children.Count);
}
}
}