PageRenderTime 25ms CodeModel.GetById 15ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/NRefactory/ICSharpCode.NRefactory.VB.Tests/Parser/Statements/SwitchStatementTests.cs

http://github.com/icsharpcode/ILSpy
C# | 34 lines | 28 code | 3 blank | 3 comment | 0 complexity | 1e4cec673e568d9c2c7da525a32fbd89 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 SwitchStatementTests
14	{
15		#region VB.NET
16		[Test]
17		public void VBSwitchStatementTest()
18		{
19			SwitchStatement switchStmt = ParseUtil.ParseStatement<SwitchStatement>("Select Case a\n Case 4, 5\n Case 6\n Case Else\n End Select");
20			Assert.AreEqual("a", ((SimpleNameExpression)switchStmt.SwitchExpression).Identifier);
21			// TODO: Extend test
22		}
23		
24		[Test]
25		public void InvalidVBSwitchStatementTest()
26		{
27			SwitchStatement switchStmt = ParseUtil.ParseStatement<SwitchStatement>("Select Case a\n Case \n End Select", true);
28			Assert.AreEqual("a", ((SimpleNameExpression)switchStmt.SwitchExpression).Identifier);
29			SwitchSection sec = switchStmt.SwitchSections[0];
30			Assert.AreEqual(0, sec.SwitchLabels.Count);
31		}
32		#endregion
33	}
34}