public async Task ReadWriteCompleted() { var response = new CompletedBuildResponse(42, utf8output: false, output: "a string"); var memoryStream = new MemoryStream(); await response.WriteAsync(memoryStream, default(CancellationToken)); Assert.True(memoryStream.Position > 0); memoryStream.Position = 0; var read = (CompletedBuildResponse)(await BuildResponse.ReadAsync(memoryStream, default(CancellationToken))); Assert.Equal(42, read.ReturnCode); Assert.False(read.Utf8Output); Assert.Equal("a string", read.Output); }
public void ReadWriteCompleted() { Task.Run(async() => { var response = new CompletedBuildResponse(42, utf8output: false, output: "a string", errorOutput: "b string"); var memoryStream = new MemoryStream(); await response.WriteAsync(memoryStream, default(CancellationToken)).ConfigureAwait(false); Assert.True(memoryStream.Position > 0); memoryStream.Position = 0; var read = (CompletedBuildResponse)(await BuildResponse.ReadAsync(memoryStream, default(CancellationToken)).ConfigureAwait(false)); Assert.Equal(42, read.ReturnCode); Assert.False(read.Utf8Output); Assert.Equal("a string", read.Output); Assert.Equal("b string", read.ErrorOutput); }).Wait(); }
public void ReadWriteCompleted() { Task.Run(async () => { var response = new CompletedBuildResponse(42, utf8output: false, output: "a string", errorOutput: "b string"); var memoryStream = new MemoryStream(); await response.WriteAsync(memoryStream, default(CancellationToken)).ConfigureAwait(false); Assert.True(memoryStream.Position > 0); memoryStream.Position = 0; var read = (CompletedBuildResponse)(await BuildResponse.ReadAsync(memoryStream, default(CancellationToken)).ConfigureAwait(false)); Assert.Equal(42, read.ReturnCode); Assert.False(read.Utf8Output); Assert.Equal("a string", read.Output); Assert.Equal("b string", read.ErrorOutput); }).Wait(); }