PageRenderTime 31ms CodeModel.GetById 23ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Expressions/ArrayCreateExpressionTests.cs

http://github.com/icsharpcode/ILSpy
C# | 36 lines | 29 code | 5 blank | 2 comment | 0 complexity | 5f66ffc570b2d63bc1caf3c3257fce05 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 System.IO;
 6using NUnit.Framework;
 7using ICSharpCode.NRefactory.VB.Parser;
 8using ICSharpCode.NRefactory.VB.Ast;
 9
10namespace ICSharpCode.NRefactory.VB.Tests.Ast
11{
12	[TestFixture]
13	public class ArrayCreateExpressionTests
14	{
15		[Test]
16		public void ArrayCreateExpressionTest1()
17		{
18			ArrayCreateExpression ace = ParseUtil.ParseExpression<ArrayCreateExpression>("new Integer() {1, 2, 3, 4}");
19			
20			Assert.AreEqual("System.Int32", ace.CreateType.Type);
21			Assert.AreEqual(0, ace.Arguments.Count);
22			Assert.AreEqual(new int[] {0}, ace.CreateType.RankSpecifier);
23		}
24		
25		[Test]
26		public void ArrayCreateExpressionTest2()
27		{
28			ArrayCreateExpression ace = ParseUtil.ParseExpression<ArrayCreateExpression>("New Integer(0 To 5){0, 1, 2, 3, 4, 5}");
29			
30			Assert.AreEqual("System.Int32", ace.CreateType.Type);
31			Assert.AreEqual(1, ace.Arguments.Count);
32			Assert.AreEqual(5, (ace.Arguments[0] as PrimitiveExpression).Value);
33			Assert.AreEqual(new int[] {0}, ace.CreateType.RankSpecifier);
34		}
35	}
36}