コード例 #1
0
        public void CSharpGotoStatementTest()
        {
            GotoStatement gotoStmt = ParseUtilCSharp.ParseStatement <GotoStatement>("goto myLabel;");

            Assert.AreEqual("myLabel", gotoStmt.Label);
        }
コード例 #2
0
 public void CSharpUsingStatementTest()
 {
     UsingStatement usingStmt = ParseUtilCSharp.ParseStatement <UsingStatement>("using (MyVar var = new MyVar()) { } ");
     // TODO : Extend test.
 }
コード例 #3
0
        public void CSharpSizeOfExpressionTest()
        {
            SizeOfExpression soe = ParseUtilCSharp.ParseExpression <SizeOfExpression>("sizeof(MyType)");

            Assert.AreEqual("MyType", soe.TypeReference.Type);
        }
コード例 #4
0
 public void CSharpSwitchStatementTest()
 {
     SwitchStatement switchStmt = ParseUtilCSharp.ParseStatement <SwitchStatement>("switch (a) { case 5: break; case 6: break; default: break; }");
     // TODO : Extend test.
 }
コード例 #5
0
 public void CSharpSimpleInvocationExpressionTest()
 {
     CheckSimpleInvoke(ParseUtilCSharp.ParseExpression <InvocationExpression>("myMethod()"));
 }
コード例 #6
0
        public void CSharpSimpleDefaultValue()
        {
            DefaultValueExpression toe = ParseUtilCSharp.ParseExpression <DefaultValueExpression>("default(T)");

            Assert.AreEqual("T", toe.TypeReference.Type);
        }
コード例 #7
0
 public void CSharpSimpleTryCatchStatementTest()
 {
     TryCatchStatement tryCatchStatement = ParseUtilCSharp.ParseStatement <TryCatchStatement>("try { } catch { } ");
     // TODO : Extend test.
 }
コード例 #8
0
        public void CSharpSimpleTypeOfExpressionTest()
        {
            TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(MyNamespace.N1.MyType)");

            Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
        }
コード例 #9
0
        public void CSharpGlobalTypeOfExpressionTest()
        {
            TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(global::System.Console)");

            Assert.AreEqual("System.Console", toe.TypeReference.Type);
        }
コード例 #10
0
        public void CSharpThrowStatementTest()
        {
            ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement <ThrowStatement>("throw new Exception();");

            Assert.IsTrue(throwStmt.Expression is ObjectCreateExpression);
        }
コード例 #11
0
 public void CSharpFixedStatementTest()
 {
     FixedStatement fixedStmt = ParseUtilCSharp.ParseStatement <FixedStatement>("fixed (int* ptr = &myIntArr) { }");
     // TODO : Extend test.
 }
コード例 #12
0
        public void CSharpEmptyThrowStatementTest()
        {
            ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement <ThrowStatement>("throw;");

            Assert.IsTrue(throwStmt.Expression.IsNull);
        }
コード例 #13
0
        public void YieldBreakStatementTest()
        {
            YieldStatement yieldStmt = ParseUtilCSharp.ParseStatement <YieldStatement>("yield break;");

            Assert.IsTrue(yieldStmt.IsYieldBreak());
        }
コード例 #14
0
 public void CSharpForStatementTest()
 {
     ForStatement forStmt = ParseUtilCSharp.ParseStatement <ForStatement>("for (int i = 5; i < 6; ++i) {} ");
     // TODO : Extend test.
 }
コード例 #15
0
        public void CSharpUncheckedStatementTest()
        {
            UncheckedStatement uncheckedStatement = ParseUtilCSharp.ParseStatement <UncheckedStatement>("unchecked { }");

            Assert.IsFalse(uncheckedStatement.Block.IsNull);
        }
コード例 #16
0
        public void CSharpPrimitiveTypeOfExpressionTest()
        {
            TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(int)");

            Assert.AreEqual("System.Int32", toe.TypeReference.SystemType);
        }
コード例 #17
0
 AnonymousMethodExpression Parse(string program)
 {
     return(ParseUtilCSharp.ParseExpression <AnonymousMethodExpression>(program));
 }
コード例 #18
0
        public void CSharpVoidTypeOfExpressionTest()
        {
            TypeOfExpression toe = ParseUtilCSharp.ParseExpression <TypeOfExpression>("typeof(void)");

            Assert.AreEqual("System.Void", toe.TypeReference.SystemType);
        }
コード例 #19
0
        public void CSharpFullQualifiedDefaultValue()
        {
            DefaultValueExpression toe = ParseUtilCSharp.ParseExpression <DefaultValueExpression>("default(MyNamespace.N1.MyType)");

            Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
        }
コード例 #20
0
        public void CSharpGotoCaseDefaltStatementTest()
        {
            GotoCaseStatement gotoCaseStmt = ParseUtilCSharp.ParseStatement <GotoCaseStatement>("goto default;");

            Assert.IsTrue(gotoCaseStmt.IsDefaultCase);
        }
コード例 #21
0
 public void CSharpSimpleTryCatchFinallyStatementTest()
 {
     TryCatchStatement tryCatchStatement = ParseUtilCSharp.ParseStatement <TryCatchStatement>("try { } catch (Exception) { } finally { } ");
     // TODO : Extend test.
 }
コード例 #22
0
 public void CSharpContinueStatementTest()
 {
     ContinueStatement continueStmt = ParseUtilCSharp.ParseStatement <ContinueStatement>("continue;");
 }
コード例 #23
0
        public void CSharpCheckedExpressionTest()
        {
            CheckedExpression ce = ParseUtilCSharp.ParseExpression <CheckedExpression>("checked(a)");

            Assert.IsTrue(ce.Expression is IdentifierExpression);
        }
コード例 #24
0
 public void CSharpThisReferenceExpressionTest1()
 {
     ThisReferenceExpression tre = ParseUtilCSharp.ParseExpression <ThisReferenceExpression>("this");
 }
コード例 #25
0
 public void CSharpGenericInvocationExpressionTest()
 {
     CheckGenericInvoke(ParseUtilCSharp.ParseExpression <InvocationExpression>("myMethod<char>('a')"));
 }
コード例 #26
0
        public void CSharpEmptyReturnStatementTest()
        {
            ReturnStatement returnStatement = ParseUtilCSharp.ParseStatement <ReturnStatement>("return;");

            Assert.IsTrue(returnStatement.Expression.IsNull);
        }
コード例 #27
0
        public void CSharpConstructorDeclarationTest1()
        {
            ConstructorDeclaration cd = ParseUtilCSharp.ParseTypeMember <ConstructorDeclaration>("MyClass() {}");

            Assert.IsTrue(cd.ConstructorInitializer.IsNull);
        }
コード例 #28
0
        public void CSharpBaseReferenceExpressionTest1()
        {
            FieldReferenceExpression fre = ParseUtilCSharp.ParseExpression <FieldReferenceExpression>("base.myField");

            Assert.IsTrue(fre.TargetObject is BaseReferenceExpression);
        }
コード例 #29
0
        public void SimpleCSharpDelegateDeclarationTest()
        {
            string program = "public delegate void MyDelegate(int a, int secondParam, MyObj lastParam);\n";

            TestDelegateDeclaration(ParseUtilCSharp.ParseGlobal <DelegateDeclaration>(program));
        }
コード例 #30
0
        public void CSharpStatementExpressionTest1()
        {
            StatementExpression stmtExprStmt = ParseUtilCSharp.ParseStatement <StatementExpression>("yield.yield;");

            Assert.IsTrue(stmtExprStmt.Expression is FieldReferenceExpression);
        }