private TestMessage CreateOutputMessage(Stream innerStream, WriterTestConfiguration testConfiguration, ODataPayloadElement payload) { TestStream messageStream = new TestStream(innerStream); TestWriterUtils.SetFailAsynchronousCalls(messageStream, testConfiguration.Synchronous); var boundary = this.PayloadElement.GetAnnotation <BatchBoundaryAnnotation>(); // We create a new test configuration for batch because the payload indicates whether we are dealing with a request or a response and the configuration won't know that in advance var newTestConfig = new WriterTestConfiguration(testConfiguration.Format, testConfiguration.MessageWriterSettings, this.PayloadElement is BatchRequestPayload, testConfiguration.Synchronous); TestMessage testMessage = TestWriterUtils.CreateOutputMessageFromStream(messageStream, newTestConfig, this.PayloadKind, boundary.BatchBoundaryInHeader, this.UrlResolver); return(testMessage); }