コード例 #1
0
        public async Task GivenAMessageWhenAnExceptionOccursThenTheExceptionIsThrownAsync()
        {
            var handler = new TestableSynchronousHandler <Message>();

            _ = await Assert.ThrowsAsync <NotImplementedException>(
                () => handler.ExecuteAsync(new SerializableMessage(), CancellationToken.None));
        }
コード例 #2
0
        public async Task GivenAMessageThenTheMessageIsPropagatedAsync()
        {
            bool wasInvoked = false;
            var  expected   = new SerializableMessage();

            var handler = new TestableSynchronousHandler <Message>(execute: actual =>
            {
                wasInvoked = true;

                Assert.Equal(expected, actual);
            });

            await handler.ExecuteAsync(expected, CancellationToken.None);

            Assert.True(wasInvoked);
        }