public Document Build(string body) { var source = new Source(body); var result = _parser.Parse(source); var document = _converter.Convert(body, result); document.OriginalQuery = body; return(document); }
public void operation_comment_should_not_be_null() { const string query = @"#comment query _ { person { name } }"; var document = CoreToVanillaConverter.Convert(query, _parser.Parse(new Source(query))); document.Operations.First().Comment.ShouldBe("comment"); }
public void operation_comment_should_be_null() { const string query = @" query _ { person { name } }"; var document = CoreToVanillaConverter.Convert(Parser.Parse(query)); document.Operations.First().Comment.ShouldBeNull(); }
public void operation_comment_should_not_be_null() { const string query = @"#comment query _ { person { name } }"; var document = CoreToVanillaConverter.Convert(Parser.Parse(query, new ParserOptions { Ignore = IgnoreOptions.None })); document.Operations.First().Comment.ShouldBe("comment"); }
public void field_comment_should_be_null() { const string query = @" query _ { person { name } }"; var document = CoreToVanillaConverter.Convert(query, _parser.Parse(new Source(query))); document.Operations.First() .SelectionSet.Selections.OfType <Field>().First().Comment.ShouldBeNull(); document.Operations.First() .SelectionSet.Selections.OfType <Field>().First() .SelectionSet.Selections.OfType <Field>().First().Comment.ShouldBeNull(); }
public void argument_comment_should_not_be_null() { const string query = @" query _ { person( #comment _where: ""foo"") { name } }"; var document = CoreToVanillaConverter.Convert(query, _parser.Parse(new Source(query))); document.Operations.First() .SelectionSet.Selections.OfType <Field>().First() .Arguments.First().Comment.ShouldBe("comment"); }
public void fragmentdefinition_comment_should_not_be_null() { const string query = @" query _ { person { ...human } } #comment fragment human on person { name }"; var document = CoreToVanillaConverter.Convert(query, _parser.Parse(new Source(query))); document.Fragments.First().Comment.ShouldBe("comment"); }
public void inlinefragment_comment_should_not_be_null() { const string query = @" query _ { person { #comment ... on human { name } } }"; var document = CoreToVanillaConverter.Convert(query, _parser.Parse(new Source(query))); document.Operations.First() .SelectionSet.Selections.OfType <Field>().First() .SelectionSet.Selections.OfType <InlineFragment>().First().Comment.ShouldBe("comment"); }
public Document Build(string body) { var source = new Source(body); GraphQLDocument result; try { result = _parser.Parse(source); } catch (GraphQLSyntaxErrorException ex) { throw new SyntaxError(ex); } var document = CoreToVanillaConverter.Convert(body, result); document.OriginalQuery = body; return(document); }
public Document Build(string body) { GraphQLDocument result; try { result = Parser.Parse(body, new ParserOptions { Ignore = IgnoreComments ? IgnoreOptions.IgnoreComments : IgnoreOptions.None }); } catch (GraphQLSyntaxErrorException ex) { throw new SyntaxError(ex); } var document = CoreToVanillaConverter.Convert(result); document.OriginalQuery = body; return(document); }
public void field_comment_should_not_be_null() { const string query = @" query _ { #comment1 person { #comment2 name } }"; var document = CoreToVanillaConverter.Convert(Parser.Parse(query, new ParserOptions { Ignore = IgnoreOptions.None })); document.Operations.First() .SelectionSet.Selections.OfType <Field>().First().Comment.ShouldBe("comment1"); document.Operations.First() .SelectionSet.Selections.OfType <Field>().First() .SelectionSet.Selections.OfType <Field>().First().Comment.ShouldBe("comment2"); }
public void fragmentspread_comment_should_not_be_null() { const string query = @" query _ { person { #comment ...human } } fragment human on person { name }"; var document = CoreToVanillaConverter.Convert(Parser.Parse(query, new ParserOptions { Ignore = IgnoreOptions.None })); document.Operations.First() .SelectionSet.Selections.OfType <Field>().First() .SelectionSet.Selections.OfType <FragmentSpread>().First().Comment.ShouldBe("comment"); }
public Document Convert() { return(CoreToVanillaConverter.Convert(GraphQLDocument)); }