示例#1
0
        public async Task TestOutput()
        {
            HttpResponseMessage m = await _client.GetAsync("/Example/Output");

            Assert.DoesNotThrow(() => m.EnsureSuccessStatusCode());
            Assert.AreEqual(ProtobufFormatterUtils.BinContentType, m.Content.Headers.ContentType.ToString());

            ExampleProto proto = ExampleProto.Parser.ParseFrom(await m.Content.ReadAsByteArrayAsync());

            Assert.AreEqual(ExampleProto.Output, proto);
        }
示例#2
0
 public IActionResult Input([FromBody] ExampleProto proto)
 {
     return(proto.Equals(ExampleProto.Input) ? Ok() : (IActionResult)BadRequest());
 }