コード例 #1
0
ファイル: ExpressionActionsTests.cs プロジェクト: aws/cta
        public void ExpressionActionAddComment()
        {
            var comment          = "Super comment";
            var expressionAction = SyntaxFactory.ExpressionStatement(SyntaxFactory.ParseExpression("var t = 1+5"));

            var addCommentFunc = _expressionActions.GetAddCommentAction(comment);
            var newNode        = addCommentFunc(_syntaxGenerator, expressionAction);

            var expectedResult = @"/* Added by CTA: Super comment */
var t  =  1 + 5 ;";

            Assert.AreEqual(expectedResult, newNode.ToFullString());
        }
コード例 #2
0
        public void InvocationExpressionEquals()
        {
            var expressionAction = new ExpressionAction()
            {
                Key = "Test", Value = "Test2", ExpressionActionFunc = _expressionActions.GetAddCommentAction("Test")
            };
            var cloned = expressionAction.Clone <ExpressionAction>();

            Assert.True(expressionAction.Equals(cloned));

            cloned.Value = "DifferentValue";
            Assert.False(expressionAction.Equals(cloned));
        }