public void OfApprovedApprenticeshipThenIsEndDateLockedForUpdateShouldBeSetCorrectly(bool expected, bool unchanged, bool dataLockSuccess, bool isStartDateInFuture, bool isAfterLastAcademicYearFundingPeriod, AcademicYearValidationResult academicYearValidationResult) { AcademicYearValidator.Setup(m => m.IsAfterLastAcademicYearFundingPeriod).Returns(isAfterLastAcademicYearFundingPeriod); AcademicYearValidator.Setup(m => m.Validate(It.IsAny <DateTime>())).Returns(academicYearValidationResult); var apprenticeship = new Apprenticeship { PaymentStatus = PaymentStatus.Active, HasHadDataLockSuccess = dataLockSuccess, StartDate = _now.AddMonths(isStartDateInFuture ? 1 : -1) }; var commitment = new CommitmentView { AgreementStatus = AgreementStatus.BothAgreed }; var viewModel = Sut.MapToApprenticeshipViewModel(apprenticeship, commitment); Assert.AreEqual(expected, viewModel.IsEndDateLockedForUpdate); if (unchanged) { Assert.AreEqual(viewModel.IsLockedForUpdate, viewModel.IsEndDateLockedForUpdate); } }
public void Arrange() { _now = new DateTime(DateTime.Now.Year, 11, 01); AcademicYearValidator.Setup(m => m.IsAfterLastAcademicYearFundingPeriod).Returns(true); AcademicYearValidator.Setup(m => m.Validate(It.IsAny <DateTime>())).Returns(AcademicYearValidationResult.Success); MockDateTime.Setup(m => m.Now).Returns(_now); }
public void ShouldHaveLockedStatusIfPastCutOffDate() { AcademicYearValidator.Setup(m => m.IsAfterLastAcademicYearFundingPeriod).Returns(true); AcademicYearValidator.Setup(m => m.Validate(It.IsAny <DateTime>())).Returns(AcademicYearValidationResult.NotWithinFundingPeriod); var apprenticeship = new Apprenticeship { StartDate = _now.AddMonths(-5), HasHadDataLockSuccess = false, PaymentStatus = PaymentStatus.Active }; var viewModel = Sut.MapToApprenticeshipViewModel(apprenticeship, new CommitmentView()); viewModel.IsLockedForUpdate.Should().BeTrue(); viewModel.IsEndDateLockedForUpdate.Should().BeTrue(); viewModel.HasStarted.Should().BeTrue(); }