public void SetUp() { // Create a request object and get the binary representation of it expectedRequest = new Schema.KRPC.Request(); expectedRequest.Calls.Add( new Schema.KRPC.ProcedureCall { Service = "TestService", Procedure = "ProcedureNoArgsNoReturn" }); using (var stream = new MemoryStream()) { expectedRequest.WriteTo(stream); stream.Flush(); requestBytes = stream.ToArray(); } // Create a response object and get the binary representation of it expectedResponseMessage = new Response(); expectedResponseMessage.Error = new Error("SomeErrorMessage", "StackTrace"); expectedResponse = expectedResponseMessage.ToProtobufMessage(); using (var stream = new MemoryStream()) { expectedResponse.WriteTo(stream); stream.Flush(); responseBytes = stream.ToArray(); } }