public async Task GivenAMessageThenMessageInvokingIsRaisedAfterTheInvokeIsPerformedAsync() { var bus = new TestableBus(false); var message = new SerializableMessage(); bool wasInvoked = false; bus.Invoked += (_, _) => Task.FromResult(wasInvoked = true); await bus.InvokeAsync(message); Assert.True(wasInvoked); }
public async Task GivenAMessageThenMessageInvokingIsRaisedBeforeTheInvokeIsPerformedAsync() { var bus = new TestableBus(true); var message = new SerializableMessage(); bool wasInvoked = false; bus.Invoking += (_, _) => Task.FromResult(wasInvoked = true); _ = await Assert.ThrowsAsync <InvalidOperationException>( () => bus.InvokeAsync(message)); Assert.True(wasInvoked); }