Esempio n. 1
0
        public async Task GivenAMessageWhenAnExceptionOccursThenTheExceptionIsThrownAsync()
        {
            var handler = new TestableSynchronousHandler <Message>();

            _ = await Assert.ThrowsAsync <NotImplementedException>(
                () => handler.ExecuteAsync(new SerializableMessage(), CancellationToken.None));
        }
Esempio n. 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);
        }