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);
        }
Exemplo n.º 2
0
        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);
        }