コード例 #1
0
ファイル: VisitorTests.cs プロジェクト: amarant/GraphQLSharp
        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>();
        }
コード例 #2
0
ファイル: VisitorTests.cs プロジェクト: amarant/GraphQLSharp
        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>();
        }