コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: BuildProtocolTest.cs プロジェクト: LFROTTIER/roslyn
 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();
 }
コード例 #3
0
 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();
 }