public async Task Then_a_ChangeOfCircumstance_is_persisted()
        {
            //Arrange
            var apprenticeshipIncentiveModel = _fixture.Build <ApprenticeshipIncentiveModel>()
                                               .Without(x => x.BreakInLearnings)
                                               .Create();

            var @event = new StartDateChanged(
                apprenticeshipIncentiveModel.Id,
                _fixture.Create <DateTime>(),
                _fixture.Create <DateTime>(),
                apprenticeshipIncentiveModel);

            //Act
            await _sut.Handle(@event);

            //Assert
            _mockChangeOfCircumstancesDataRepository.Verify(m =>
                                                            m.Save(It.Is <ChangeOfCircumstance>(i =>
                                                                                                i.ApprenticeshipIncentiveId == @event.ApprenticeshipIncentiveId &&
                                                                                                i.Type == Enums.ChangeOfCircumstanceType.StartDate &&
                                                                                                i.NewValue == @event.NewStartDate.ToString("yyyy-MM-dd") &&
                                                                                                i.PreviousValue == @event.PreviousStartDate.ToString("yyyy-MM-dd")
                                                                                                )),
                                                            Times.Once);
        }
예제 #2
0
        public async Task Then_a_ChangeOfCircumstance_is_persisted()
        {
            //Arrange
            var @event = _fixture.Create <StartDateChanged>();

            //Act
            await _sut.Handle(@event);

            //Assert
            _mockChangeOfCircumstancesDataRepository.Verify(m =>
                                                            m.Save(It.Is <ChangeOfCircumstance>(i =>
                                                                                                i.ApprenticeshipIncentiveId == @event.ApprenticeshipIncentiveId &&
                                                                                                i.Type == Enums.ChangeOfCircumstanceType.StartDate &&
                                                                                                i.NewValue == @event.NewStartDate.ToString("yyyy-MM-dd") &&
                                                                                                i.PreviousValue == @event.PreviousStartDate.ToString("yyyy-MM-dd")
                                                                                                )),
                                                            Times.Once);
        }