コード例 #1
0
        public async Task InsertInException_IfHandlingTransformException()
        {
            // Arrange
            byte[] expectedBody = Encoding.UTF8.GetBytes("serialize me!");

            using (var bodyStore = new InMemoryMessageBodyStore())
                using (var stream = new MemoryStream(expectedBody))
                {
                    var sut = new PullSendAgentExceptionHandler(GetDataStoreContext, StubConfig.Default, bodyStore);

                    // Act
                    await sut.HandleTransformationException(
                        new Exception(_expectedMessage),
                        new ReceivedMessage(stream));
                }
            // Assert
            GetDataStoreContext.AssertOutException(
                ex =>
            {
                Assert.NotNull(ex);
                Assert.Equal(_expectedMessage, ex.Exception);
            });
        }