Esempio n. 1
0
        public void AllowsForEditingOnEnter()
        {
            var ast = Parser.Parse("{ a, b, c { a, b, c } }", new ParseOptions
            {
                NoLocation = true,
            });
            var visitor   = new AllowsForEditingOnEnterStackWalker();
            var editedAst = visitor.Visit(ast);

            ast.ShouldBeEquivalentToDeepDynamic(Parser.Parse("{ a, b, c { a, b, c } }", new ParseOptions
            {
                NoLocation = true,
            }));

            var expectation = Parser.Parse("{ a,    c { a,    c } }", new ParseOptions
            {
                NoLocation = true,
            });

            editedAst.ShouldBeEquivalentToDeepDynamic(expectation);

            var noexpectation = Parser.Parse("{ a, b, c { a,    c } }", new ParseOptions
            {
                NoLocation = true,
            });
            Action action = () =>
                            ast.ShouldBeEquivalentToDeepDynamic(noexpectation);

            action.ShouldThrow <Exception>();
        }
Esempio n. 2
0
        public void AllowsForEditingOnEnter()
        {
            var ast = Parser.Parse("{ a, b, c { a, b, c } }", new ParseOptions
            {
                NoLocation = true,
            });
            var visitor = new AllowsForEditingOnEnterStackWalker();
            var editedAst = visitor.Visit(ast);

            ast.ShouldBeEquivalentToDeepDynamic(Parser.Parse("{ a, b, c { a, b, c } }", new ParseOptions
                {
                    NoLocation = true,
                }));

            var expectation = Parser.Parse("{ a,    c { a,    c } }", new ParseOptions
            {
                NoLocation = true,
            });
            editedAst.ShouldBeEquivalentToDeepDynamic(expectation);

            var noexpectation = Parser.Parse("{ a, b, c { a,    c } }", new ParseOptions
            {
                NoLocation = true,
            });
            Action action = () =>
                ast.ShouldBeEquivalentToDeepDynamic(noexpectation);
            action.ShouldThrow<Exception>();
        }