Beispiel #1
0
        public async void Empty_Should_ThrowException(
            [Frozen] Mock <IMediator> mediator
            , EventCanceledIntegrationEventHandler handler
            )
        {
            // ARRANGE
            var evt = new EventCanceledIntegrationEvent(Guid.NewGuid(), Guid.Empty);

            // ACT
            await Assert.ThrowsAnyAsync <IntegrationEventException>(() => handler.Handle(evt));

            // ASSERT
            mediator.VerifyNoOtherCalls();
        }
Beispiel #2
0
        public async void Handle_Should_Success(
            [Frozen] Mock <IMediator> mediator
            , [Frozen] EventCanceledIntegrationEvent @event
            , EventCanceledIntegrationEventHandler handler)
        {
            // ARRANGE
            mediator.Setup(r => r.Send(It.IsAny <IRequest <bool> >(), It.IsAny <CancellationToken>()));

            // ACT
            await handler.Handle(@event);

            // ARRANGE
            mediator.Verify(p => p.Send(It.IsAny <IRequest <bool> >(), It.IsAny <CancellationToken>()), Times.Once);

            mediator.VerifyNoOtherCalls();
        }