public void When_custom_deserializer_throws_HttpProblemDetailsException_then_it_should_propagate() { var expected = new HttpProblemDetailsException<HttpProblemDetails>(new HttpProblemDetails()); var sut = new CommandHandlingSettings(A.Fake<ICommandHandlerResolver>(), A.Fake<ResolveCommandType>()) { DeserializeCommand = (_, __) => { throw expected; } }; Exception thrown = null; try { using (var reader = new StringReader("xyx")) { sut.DeserializeCommand(reader, typeof(CommandHandlingSettingsTests)); } } catch(Exception ex) { thrown = ex; } thrown.Should().Be(expected); }
public void When_custom_deserializer_throws_HttpProblemDetailsException_then_it_should_propagate() { var expected = new HttpProblemDetailsException <HttpProblemDetails>(new HttpProblemDetails()); var sut = new CommandHandlingSettings(A.Fake <ICommandHandlerResolver>(), A.Fake <ResolveCommandType>()) { DeserializeCommand = (_, __) => { throw expected; } }; Exception thrown = null; try { using (var reader = new StringReader("xyx")) { sut.DeserializeCommand(reader, typeof(CommandHandlingSettingsTests)); } } catch (Exception ex) { thrown = ex; } thrown.ShouldBe(expected); }