PageRenderTime 19ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/TypeLevel/ConstructorDeclarationTests.cs

http://github.com/icsharpcode/ILSpy
C# | 34 lines | 29 code | 3 blank | 2 comment | 0 complexity | 310ace168b13347fc35fe4369447045e MD5 | raw file
 1// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 2// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 3
 4using System;
 5using ICSharpCode.NRefactory.VB.Ast;
 6using NUnit.Framework;
 7
 8namespace ICSharpCode.NRefactory.VB.Tests.Ast
 9{
10	[TestFixture]
11	public class ConstructorDeclarationTests
12	{
13		#region VB.NET
14		[Test]
15		public void VBNetConstructorDeclarationTest1()
16		{
17			string program = @"Sub New()
18								End Sub";
19			ConstructorDeclaration cd = ParseUtil.ParseTypeMember<ConstructorDeclaration>(program);
20			Assert.IsTrue(cd.ConstructorInitializer.IsNull);
21		}
22		
23		[Test]
24		public void VBNetConstructorDeclarationTest2()
25		{
26			ConstructorDeclaration cd = ParseUtil.ParseTypeMember<ConstructorDeclaration>("Sub New(x As Integer, Optional y As String) \nEnd Sub");
27			Assert.AreEqual(2, cd.Parameters.Count);
28			Assert.AreEqual("System.Int32", cd.Parameters[0].TypeReference.Type);
29			Assert.AreEqual("System.String", cd.Parameters[1].TypeReference.Type);
30			Assert.AreEqual(ParameterModifiers.Optional, cd.Parameters[1].ParamModifier & ParameterModifiers.Optional);
31		}
32		#endregion
33	}
34}