Exemplo n.º 1
0
 public void CSharpGenericInvocation2ExpressionTest()
 {
     CheckGenericInvoke2(ParseUtilCSharp.ParseExpression <InvocationExpression>("myMethod<T,bool>()"));
 }
        public void CSharpCheckedStatementTest()
        {
            CheckedStatement checkedStatement = ParseUtilCSharp.ParseStatement <CheckedStatement>("checked { }");

            Assert.IsFalse(checkedStatement.Block.IsNull);
        }
 public void CSharpSimpleInvocationExpressionTest()
 {
     CheckSimpleInvoke(ParseUtilCSharp.ParseExpression <InvocationExpression>("myMethod()"));
 }
        public void CSharpExternDestructorDeclarationTest()
        {
            DestructorDeclaration dd = ParseUtilCSharp.ParseTypeMember <DestructorDeclaration>("extern ~MyClass();");

            Assert.AreEqual(Modifiers.Extern, dd.Modifier);
        }
 public void CSharpBreakStatementTest()
 {
     BreakStatement breakStmt = ParseUtilCSharp.ParseStatement <BreakStatement>("break;");
 }
Exemplo n.º 6
0
 static LambdaExpression ParseCSharp(string program)
 {
     return(ParseUtilCSharp.ParseExpression <LambdaExpression>(program));
 }
        public void CSharpStatementExpressionTest1()
        {
            ExpressionStatement stmtExprStmt = ParseUtilCSharp.ParseStatement <ExpressionStatement>("yield.yield;");

            Assert.IsTrue(stmtExprStmt.Expression is FieldReferenceExpression);
        }
Exemplo n.º 8
0
        public void CSharpGlobalTypeOfExpressionTest()
        {
            TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(global::System.Console)");

            Assert.AreEqual("System.Console", toe.TypeReference.Type);
        }
Exemplo n.º 9
0
        public void CSharpPrimitiveTypeOfExpressionTest()
        {
            TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(int)");

            Assert.AreEqual("System.Int32", toe.TypeReference.Type);
        }
Exemplo n.º 10
0
        public void CSharpConstructorDeclarationTest1()
        {
            ConstructorDeclaration cd = ParseUtilCSharp.ParseTypeMember <ConstructorDeclaration>("MyClass() {}");

            Assert.IsTrue(cd.ConstructorInitializer.IsNull);
        }
Exemplo n.º 11
0
        public void CSharpSimpleTypeOfExpressionTest()
        {
            TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(MyNamespace.N1.MyType)");

            Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
        }
 public void CSharpForStatementTest()
 {
     ForStatement forStmt = ParseUtilCSharp.ParseStatement <ForStatement>("for (int i = 5; i < 6; ++i) {} ");
     // TODO : Extend test.
 }
Exemplo n.º 13
0
 AnonymousMethodExpression Parse(string program)
 {
     return(ParseUtilCSharp.ParseExpression <AnonymousMethodExpression>(program));
 }
 public void CSharpThisReferenceExpressionTest1()
 {
     ThisReferenceExpression tre = ParseUtilCSharp.ParseExpression <ThisReferenceExpression>("this");
 }
Exemplo n.º 15
0
        public void CSharpEmptyThrowStatementTest()
        {
            ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement <ThrowStatement>("throw;");

            Assert.IsTrue(throwStmt.Expression.IsNull);
        }
Exemplo n.º 16
0
        public void CSharpVoidTypeOfExpressionTest()
        {
            TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(void)");

            Assert.AreEqual("System.Void", toe.TypeReference.Type);
        }
Exemplo n.º 17
0
        public void CSharpThrowStatementTest()
        {
            ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement <ThrowStatement>("throw new Exception();");

            Assert.IsTrue(throwStmt.Expression is ObjectCreateExpression);
        }
Exemplo n.º 18
0
        public void CSharpUncheckedStatementTest()
        {
            UncheckedStatement uncheckedStatement = ParseUtilCSharp.ParseStatement <UncheckedStatement>("unchecked { }");

            Assert.IsFalse(uncheckedStatement.Block.IsNull);
        }
Exemplo n.º 19
0
        public void CSharpStatementExpressionTest()
        {
            ExpressionStatement stmtExprStmt = ParseUtilCSharp.ParseStatement <ExpressionStatement>("my.Obj.PropCall;");

            Assert.IsTrue(stmtExprStmt.Expression is FieldReferenceExpression);
        }
        public void StandaloneIntReferenceExpression()
        {
            TypeReferenceExpression tre = ParseUtilCSharp.ParseExpression <TypeReferenceExpression>("int");

            Assert.AreEqual("System.Int32", tre.TypeReference.Type);
        }
 public void CSharpDestructorDeclarationTest()
 {
     DestructorDeclaration dd = ParseUtilCSharp.ParseTypeMember <DestructorDeclaration>("~MyClass() {}");
 }
        public void CSharpSimpleDefaultValue()
        {
            DefaultValueExpression toe = ParseUtilCSharp.ParseExpression <DefaultValueExpression>("default(T)");

            Assert.AreEqual("T", toe.TypeReference.Type);
        }
        public void CSharpUnsafeDestructorDeclarationTest()
        {
            DestructorDeclaration dd = ParseUtilCSharp.ParseTypeMember <DestructorDeclaration>("unsafe ~MyClass() {}");

            Assert.AreEqual(Modifiers.Unsafe, dd.Modifier);
        }
        public void CSharpIdentifierExpressionTest2()
        {
            IdentifierExpression ident = ParseUtilCSharp.ParseExpression <IdentifierExpression>("@public");

            Assert.AreEqual("public", ident.Identifier);
        }
Exemplo n.º 25
0
 public void CSharpForeachStatementTest()
 {
     ForeachStatement foreachStmt = ParseUtilCSharp.ParseStatement <ForeachStatement>("foreach (int i in myColl) {} ");
     // TODO : Extend test.
 }
Exemplo n.º 26
0
 public void CSharpUsingStatementTest()
 {
     UsingStatement usingStmt = ParseUtilCSharp.ParseStatement <UsingStatement>("using (MyVar var = new MyVar()) { } ");
     // TODO : Extend test.
 }
        public void YieldBreakStatementTest()
        {
            YieldStatement yieldStmt = ParseUtilCSharp.ParseStatement <YieldStatement>("yield break;");

            Assert.IsTrue(yieldStmt.IsYieldBreak);
        }
Exemplo n.º 28
0
        public void CSharpUncheckedExpressionTest()
        {
            UncheckedExpression ce = ParseUtilCSharp.ParseExpression <UncheckedExpression>("unchecked(a)");

            Assert.IsTrue(ce.Expression is IdentifierExpression);
        }
 public void CSharpGenericInvocationExpressionTest()
 {
     CheckGenericInvoke(ParseUtilCSharp.ParseExpression <InvocationExpression>("myMethod<char>('a')"));
 }
        public void CSharpGotoStatementTest()
        {
            GotoStatement gotoStmt = ParseUtilCSharp.ParseStatement <GotoStatement>("goto myLabel;");

            Assert.AreEqual("myLabel", gotoStmt.Label);
        }