public override void SetUp() { base.SetUp(); ExampleValidRequest = new PauseApprenticeshipCommand { AccountId = 111L, ApprenticeshipId = 444L, DateOfChange = DateTime.Now.Date, UserName = "******" }; TestApprenticeship = new Apprenticeship { CommitmentId = 123L, PaymentStatus = PaymentStatus.Active, StartDate = DateTime.UtcNow.Date.AddMonths(6) }; MockCurrentDateTime.SetupGet(x => x.Now).Returns(DateTime.UtcNow); MockApprenticeshipRespository .Setup(x => x.GetApprenticeship(It.Is <long>(y => y == ExampleValidRequest.ApprenticeshipId))) .ReturnsAsync(TestApprenticeship); MockApprenticeshipRespository .Setup(x => x.UpdateApprenticeshipStatus(TestApprenticeship.CommitmentId, ExampleValidRequest.ApprenticeshipId, PaymentStatus.Paused)) .Returns(Task.FromResult(new object())); }
public override void SetUp() { base.SetUp(); ExampleValidRequest = new StopApprenticeshipCommand { AccountId = 111L, ApprenticeshipId = 444L, DateOfChange = DateTime.UtcNow.Date.AddMonths(6), UserName = "******" }; TestApprenticeship = new Apprenticeship { Id = 444L, CommitmentId = 123L, PaymentStatus = PaymentStatus.Active, StartDate = DateTime.UtcNow.Date.AddMonths(6) }; MockCurrentDateTime.SetupGet(x => x.Now) .Returns(DateTime.UtcNow); MockApprenticeshipRespository.Setup(x => x.GetApprenticeship(It.Is <long>(y => y == ExampleValidRequest.ApprenticeshipId))) .ReturnsAsync(TestApprenticeship); MockApprenticeshipRespository.Setup(x => x.UpdateApprenticeshipStatus( It.Is <long>(c => c == TestApprenticeship.CommitmentId), It.Is <long>(a => a == ExampleValidRequest.ApprenticeshipId), It.Is <PaymentStatus>(s => s == PaymentStatus.Withdrawn))) .Returns(Task.FromResult(new object())); MockDataLockRepository.Setup(x => x.GetDataLocks(ExampleValidRequest.ApprenticeshipId, false)) .ReturnsAsync(new List <DataLockStatus>()); MockDataLockRepository.Setup(x => x.ResolveDataLock(It.IsAny <IEnumerable <long> >())) .Returns(Task.CompletedTask); MockCommitmentRespository.Setup(x => x.GetCommitmentById( It.Is <long>(c => c == TestApprenticeship.CommitmentId))) .ReturnsAsync(new Commitment { Id = 123L, EmployerAccountId = ExampleValidRequest.AccountId }); }
public override void SetUp() { base.SetUp(); MockCurrentDateTime.SetupGet(x => x.Now).Returns(new DateTime(2017, 6, 1)); var startDate = MockCurrentDateTime.Object.Now.Date.AddMonths(-6); var pauseDate = startDate.AddMonths(1); TestApprenticeship = new Apprenticeship { CommitmentId = 123L, PaymentStatus = PaymentStatus.Paused, StartDate = startDate, PauseDate = pauseDate }; ExampleValidRequest = new ResumeApprenticeshipCommand { AccountId = 111L, ApprenticeshipId = 444L, DateOfChange = pauseDate.Date, UserName = "******" }; _testCommitment = new Commitment { Id = 123L, EmployerAccountId = ExampleValidRequest.AccountId }; MockApprenticeshipRespository.Setup(x => x.GetApprenticeship(It.Is <long>(y => y == ExampleValidRequest.ApprenticeshipId))) .ReturnsAsync(TestApprenticeship); MockApprenticeshipRespository.Setup(x => x.UpdateApprenticeshipStatus( It.Is <long>(c => c == TestApprenticeship.CommitmentId), It.Is <long>(a => a == ExampleValidRequest.ApprenticeshipId), It.Is <PaymentStatus>(s => s == PaymentStatus.Active))) .Returns(Task.FromResult(new object())); MockCommitmentRespository.Setup(x => x.GetCommitmentById( It.Is <long>(c => c == TestApprenticeship.CommitmentId))) .ReturnsAsync(_testCommitment); }
public override void SetUp() { base.SetUp(); ExampleValidRequest = new UpdateApprenticeshipStopDateCommand { AccountId = 111L, ApprenticeshipId = 444L, StopDate = DateTime.UtcNow.Date, UserName = "******" }; _testCommitment = new Commitment { Id = 123L, EmployerAccountId = ExampleValidRequest.AccountId }; TestApprenticeship = new Apprenticeship { Id = 444L, CommitmentId = 123L, PaymentStatus = PaymentStatus.Withdrawn, StopDate = DateTime.UtcNow.Date.AddMonths(3), StartDate = DateTime.UtcNow.Date.AddMonths(-1) }; MockCurrentDateTime.SetupGet(x => x.Now) .Returns(DateTime.UtcNow); MockApprenticeshipRespository.Setup(x => x.GetApprenticeship(It.Is<long>(y => y == ExampleValidRequest.ApprenticeshipId))) .ReturnsAsync(TestApprenticeship); MockApprenticeshipRespository.Setup(x => x.UpdateApprenticeshipStatus(It.IsAny<long>(), It.IsAny<long>(), It.IsAny<PaymentStatus>())) .Returns(Task.FromResult(new object())); MockDataLockRepository.Setup(x => x.GetDataLocks(ExampleValidRequest.ApprenticeshipId, false)) .ReturnsAsync(new List<DataLockStatus>()); MockCommitmentRespository.Setup(x => x.GetCommitmentById(123L)).ReturnsAsync(_testCommitment); MockApprenticeshipEventsPublisher.Setup(x => x.Publish(It.IsAny<IApprenticeshipEventsList>())) .Returns(Task.FromResult(new Unit())); }