public void SerializeAsync_SchemaIsNull_ArgumentNullException() { // arrange // act async Task Action() => await SchemaSerializer.SerializeAsync(null, new MemoryStream()); // assert Assert.ThrowsAsync <ArgumentNullException>(Action); }
public void SerializeAsync_WriterIsNull_ArgumentNullException() { // arrange ISchema schema = SchemaBuilder.New() .AddDocumentFromString("type Query { foo: String }") .AddResolver("Query", "foo", "bar") .Create(); // act async Task Action() => await SchemaSerializer.SerializeAsync(schema, null); // assert Assert.ThrowsAsync <ArgumentNullException>(Action); }
public async Task SerializeAsync_Serialize() { // arrange ISchema schema = SchemaBuilder.New() .AddDocumentFromString("type Query { foo: String }") .AddResolver("Query", "foo", "bar") .Create(); using var stream = new MemoryStream(); // act await SchemaSerializer.SerializeAsync(schema, stream); // assert Encoding.UTF8.GetString(stream.ToArray()).MatchSnapshot(); }