示例#1
0
        public void ThenTheLastProcessedEventShouldBeIncreamentedIfMaxRetryCountHasNotBeenReached()
        {
            //Act
            Assert.ThrowsAsync <ApplicationException>(async() => await _handler.Handle(new ApprenticeshipEventView()));

            //Assert
            _eventRepository.Verify(
                x => x.SetEventFailureCount(It.IsAny <long>(), _tryCount + 1), Times.Once);

            _eventRepository.Verify(
                x => x.StoreLastProcessedEventId(nameof(ApprenticeshipEventView), It.IsAny <long>()), Times.Never);
        }
        public async Task ThenTheCreateEventCommandShouldBeSent()
        {
            //Act
            await _handler.Handle(_event);

            //Assert
            _mediator.Verify(x => x.SendAsync(It.Is <CreateCommitmentApprenticeshipEntryCommand>(
                                                  c => c.Event != null && c.Event.Equals(_event))), Times.Once);
        }