상속: RDomBaseExpression, IOtherExpression
        public void ConditionalExpression_can_be_constructed()
        {
            var root = RDom.CSharp.Load(csharpCode);
             var method = root.Classes.First().Methods.First();
             var expected = "x == 1";

             var expression = new RDomOtherExpression(null, expected, ExpectedLanguages.CSharp, ExpressionType.Unknown);
             Assert.IsNotNull(expression);
             var actual = RDom.CSharp.GetSyntaxNode(expression).ToFullString();
             Assert.AreEqual(expected, actual);
        }
예제 #2
0
 internal RDomOtherExpression(RDomOtherExpression oldRDom)
     : base(oldRDom)
 { }
        public void While_statement_can_be_constructed()
        {
            var root = RDom.CSharp.Load(csharpCode);
             var method = root.Classes.First().Methods.First();

             var expression = new RDomOtherExpression(null, "x == 1", ExpectedLanguages.CSharp, ExpressionType.Unknown);
             var whileStatement = new RDomWhileStatement(expression);
             whileStatement.HasBlock = true;
             Assert.IsNotNull(expression);
             var actual = RDom.CSharp.GetSyntaxNode(whileStatement).ToFullString();

             var expected = "while (x == 1) { }";
             Assert.AreEqual(expected, actual);
             method.StatementsAll.AddOrMove(whileStatement);
             actual = RDom.CSharp.GetSyntaxNode(method).ToFullString();
             var expectedMethod = "   public int Bar()\r\n   {\r\nwhile (x == 1) { }   }\r\n";
             Assert.AreEqual(expectedMethod, actual);
        }
 internal RDomOtherExpression(RDomOtherExpression oldRDom)
     : base(oldRDom)
 {
 }