public void WhenTypeImplementsIReadDocumentThenWriteToStreamAsyncWritesCollectionJson() { var doc = new TestReadDocument(); var stream = new MemoryStream(); formatter.WriteToStreamAsync(doc.GetType(), doc, stream, null, null).Wait(); var reader = new StreamReader(stream); stream.Position = 0; var content = reader.ReadToEnd(); content.ShouldContain("\"collection\":"); content.ShouldContain("\"http://test.com/\""); }
public void WhenTypeImplementsIReadDocumentThenWriteToStreamAsyncWritesCollectionJson() { var doc = new TestReadDocument(); var stream = new MemoryStream(); formatter.WriteToStreamAsync(doc.GetType(), doc, stream, null, null).Wait(); var reader = new StreamReader(stream); stream.Position = 0; var content = reader.ReadToEnd(); content.ShouldContain("\"collection\":"); content.ShouldContain("\"http://test.com\""); }