public void CSharpGotoStatementTest() { GotoStatement gotoStmt = ParseUtilCSharp.ParseStatement <GotoStatement>("goto myLabel;"); Assert.AreEqual("myLabel", gotoStmt.Label); }
public void CSharpUsingStatementTest() { UsingStatement usingStmt = ParseUtilCSharp.ParseStatement <UsingStatement>("using (MyVar var = new MyVar()) { } "); // TODO : Extend test. }
public void CSharpSizeOfExpressionTest() { SizeOfExpression soe = ParseUtilCSharp.ParseExpression <SizeOfExpression>("sizeof(MyType)"); Assert.AreEqual("MyType", soe.TypeReference.Type); }
public void CSharpSwitchStatementTest() { SwitchStatement switchStmt = ParseUtilCSharp.ParseStatement <SwitchStatement>("switch (a) { case 5: break; case 6: break; default: break; }"); // TODO : Extend test. }
public void CSharpSimpleInvocationExpressionTest() { CheckSimpleInvoke(ParseUtilCSharp.ParseExpression <InvocationExpression>("myMethod()")); }
public void CSharpSimpleDefaultValue() { DefaultValueExpression toe = ParseUtilCSharp.ParseExpression <DefaultValueExpression>("default(T)"); Assert.AreEqual("T", toe.TypeReference.Type); }
public void CSharpSimpleTryCatchStatementTest() { TryCatchStatement tryCatchStatement = ParseUtilCSharp.ParseStatement <TryCatchStatement>("try { } catch { } "); // TODO : Extend test. }
public void CSharpSimpleTypeOfExpressionTest() { TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(MyNamespace.N1.MyType)"); Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type); }
public void CSharpGlobalTypeOfExpressionTest() { TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(global::System.Console)"); Assert.AreEqual("System.Console", toe.TypeReference.Type); }
public void CSharpThrowStatementTest() { ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement <ThrowStatement>("throw new Exception();"); Assert.IsTrue(throwStmt.Expression is ObjectCreateExpression); }
public void CSharpFixedStatementTest() { FixedStatement fixedStmt = ParseUtilCSharp.ParseStatement <FixedStatement>("fixed (int* ptr = &myIntArr) { }"); // TODO : Extend test. }
public void CSharpEmptyThrowStatementTest() { ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement <ThrowStatement>("throw;"); Assert.IsTrue(throwStmt.Expression.IsNull); }
public void YieldBreakStatementTest() { YieldStatement yieldStmt = ParseUtilCSharp.ParseStatement <YieldStatement>("yield break;"); Assert.IsTrue(yieldStmt.IsYieldBreak()); }
public void CSharpForStatementTest() { ForStatement forStmt = ParseUtilCSharp.ParseStatement <ForStatement>("for (int i = 5; i < 6; ++i) {} "); // TODO : Extend test. }
public void CSharpUncheckedStatementTest() { UncheckedStatement uncheckedStatement = ParseUtilCSharp.ParseStatement <UncheckedStatement>("unchecked { }"); Assert.IsFalse(uncheckedStatement.Block.IsNull); }
public void CSharpPrimitiveTypeOfExpressionTest() { TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(int)"); Assert.AreEqual("System.Int32", toe.TypeReference.SystemType); }
AnonymousMethodExpression Parse(string program) { return(ParseUtilCSharp.ParseExpression <AnonymousMethodExpression>(program)); }
public void CSharpVoidTypeOfExpressionTest() { TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(void)"); Assert.AreEqual("System.Void", toe.TypeReference.SystemType); }
public void CSharpFullQualifiedDefaultValue() { DefaultValueExpression toe = ParseUtilCSharp.ParseExpression <DefaultValueExpression>("default(MyNamespace.N1.MyType)"); Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type); }
public void CSharpGotoCaseDefaltStatementTest() { GotoCaseStatement gotoCaseStmt = ParseUtilCSharp.ParseStatement <GotoCaseStatement>("goto default;"); Assert.IsTrue(gotoCaseStmt.IsDefaultCase); }
public void CSharpSimpleTryCatchFinallyStatementTest() { TryCatchStatement tryCatchStatement = ParseUtilCSharp.ParseStatement <TryCatchStatement>("try { } catch (Exception) { } finally { } "); // TODO : Extend test. }
public void CSharpContinueStatementTest() { ContinueStatement continueStmt = ParseUtilCSharp.ParseStatement <ContinueStatement>("continue;"); }
public void CSharpCheckedExpressionTest() { CheckedExpression ce = ParseUtilCSharp.ParseExpression <CheckedExpression>("checked(a)"); Assert.IsTrue(ce.Expression is IdentifierExpression); }
public void CSharpThisReferenceExpressionTest1() { ThisReferenceExpression tre = ParseUtilCSharp.ParseExpression <ThisReferenceExpression>("this"); }
public void CSharpGenericInvocationExpressionTest() { CheckGenericInvoke(ParseUtilCSharp.ParseExpression <InvocationExpression>("myMethod<char>('a')")); }
public void CSharpEmptyReturnStatementTest() { ReturnStatement returnStatement = ParseUtilCSharp.ParseStatement <ReturnStatement>("return;"); Assert.IsTrue(returnStatement.Expression.IsNull); }
public void CSharpConstructorDeclarationTest1() { ConstructorDeclaration cd = ParseUtilCSharp.ParseTypeMember <ConstructorDeclaration>("MyClass() {}"); Assert.IsTrue(cd.ConstructorInitializer.IsNull); }
public void CSharpBaseReferenceExpressionTest1() { FieldReferenceExpression fre = ParseUtilCSharp.ParseExpression <FieldReferenceExpression>("base.myField"); Assert.IsTrue(fre.TargetObject is BaseReferenceExpression); }
public void SimpleCSharpDelegateDeclarationTest() { string program = "public delegate void MyDelegate(int a, int secondParam, MyObj lastParam);\n"; TestDelegateDeclaration(ParseUtilCSharp.ParseGlobal <DelegateDeclaration>(program)); }
public void CSharpStatementExpressionTest1() { StatementExpression stmtExprStmt = ParseUtilCSharp.ParseStatement <StatementExpression>("yield.yield;"); Assert.IsTrue(stmtExprStmt.Expression is FieldReferenceExpression); }