コード例 #1
0
 public void ParserExceptionsBubbleUp(
     HttpRequestMessage request,
     JSendParseException exception,
     [Frozen] IJSendParser parser,
     [Greedy, MockHttpClient] JSendClient client)
 {
     // Fixture setup
     Mock.Get(parser)
     .Setup(p => p.ParseAsync <object>(It.IsAny <JsonSerializerSettings>(), It.IsAny <HttpResponseMessage>()))
     .ThrowsAsync(exception);
     // Exercise system and verify outcome
     client
     .Awaiting(c => c.SendAsync <object>(request))
     .ShouldThrow <JSendParseException>();
 }
コード例 #2
0
 public void ParserExceptionsBubbleUp(
     HttpRequestMessage request,
     JSendParseException exception,
     [Frozen] IJSendParser parser,
     [Greedy, MockHttpClient] JSendClient client)
 {
     // Fixture setup
     Mock.Get(parser)
         .Setup(p => p.ParseAsync<object>(It.IsAny<JsonSerializerSettings>(), It.IsAny<HttpResponseMessage>()))
         .ThrowsAsync(exception);
     // Exercise system and verify outcome
     client
         .Awaiting(c => c.SendAsync<object>(request))
         .ShouldThrow<JSendParseException>();
 }