public void SerializeSchemaWriter_SchemaIsNull_ArgumentNullException() { // arrange // act void Action() => SchemaSerializer.Serialize(null, new StringWriter()); // assert Assert.Throws <ArgumentNullException>(Action); }
public void Serialize_SchemaIsNull_ArgumentNullException() { // arrange // act void Action() => SchemaSerializer.Serialize(null); // assert Assert.Throws <ArgumentNullException>(Action); }
public void SerializeSchemaWriter_WriterIsNull_ArgumentNullException() { // arrange ISchema schema = SchemaBuilder.New() .AddDocumentFromString("type Query { foo: String }") .AddResolver("Query", "foo", "bar") .Create(); // act void Action() => SchemaSerializer.Serialize(schema, null); // assert Assert.Throws <ArgumentNullException>(Action); }
public void SerializeSchemaWriter_Serialize() { // arrange ISchema schema = SchemaBuilder.New() .AddDocumentFromString("type Query { foo: String }") .AddResolver("Query", "foo", "bar") .Create(); var stringBuilder = new StringBuilder(); // act SchemaSerializer.Serialize(schema, new StringWriter(stringBuilder)); // assert stringBuilder.ToString().MatchSnapshot(); }
public void SerializeSchemaWithMutationWithoutSubscription() { // arrange string source = FileResource.Open( "serialize_schema_with_mutation.graphql"); ISchema schema = Schema.Create( source, c => { c.Use(next => context => next(context)); }); var sb = new StringBuilder(); var s = new StringWriter(sb); // act SchemaSerializer.Serialize(schema, s); // assert sb.ToString().Snapshot(); }
public void SerializeSchemaWithDirective() { // arrange string source = FileResource.Open("serialize_schema.graphql"); ISchema schema = Schema.Create( source, c => { c.Use(next => context => next(context)); c.RegisterDirective(new DirectiveType(t => t.Name("upper") .Location(DirectiveLocation.FieldDefinition))); }); var sb = new StringBuilder(); var s = new StringWriter(sb); // act SchemaSerializer.Serialize(schema, s); // assert sb.ToString().Snapshot(); }
public string Print() => SchemaSerializer.Serialize(this);
public override string ToString() { return(SchemaSerializer.Serialize(this)); }