public void Setup() { _testQuery = new ValidateStatusChangeDateQuery { AccountId = 123, ApprenticeshipId = 456, ChangeOption = ChangeOption.SpecificDate }; _mockCurrentDate = new Mock <ICurrentDateTime>(); _mockCurrentDate.SetupGet(x => x.Now).Returns(new DateTime(2017, 6, 20)); // Started training _apprenticeship = new Apprenticeship { StartDate = DateTime.UtcNow.Date }; _mockMediator = new Mock <IMediator>(); _mockMediator.Setup(x => x.SendAsync(It.IsAny <GetApprenticeshipQueryRequest>())) .ReturnsAsync(new GetApprenticeshipQueryResponse { Apprenticeship = _apprenticeship }); _handler = new ValidateStatusChangeDateQueryHandler(new ValidateStatusChangeDateQueryValidator(), _mockMediator.Object, _mockCurrentDate.Object); }
public void Setup() { _testQuery = new Application.Queries.ValidateStatusChangeDate.ValidateStatusChangeDateQuery { AccountId = 123, ApprenticeshipId = 456, ChangeOption = ChangeOption.SpecificDate }; _apprenticeship = new Apprenticeship { StartDate = DateTime.UtcNow.Date }; _mockCurrentDate = new Mock <ICurrentDateTime>(); _mockCurrentDate.SetupGet(x => x.Now).Returns(new DateTime(2017, 6, 20)); // Started training _academicYearValidator = new Mock <IAcademicYearValidator>(); _commitmentsApi = new Mock <IEmployerCommitmentApi>(); _commitmentsApi.Setup(x => x.GetEmployerApprenticeship(It.IsAny <long>(), It.IsAny <long>())) .ReturnsAsync(_apprenticeship); _handler = new ValidateStatusChangeDateQueryHandler(new ValidateStatusChangeDateQueryValidator(), _mockCurrentDate.Object, _academicYearValidator.Object, _commitmentsApi.Object); }