Exemple #1
0
        public async Task ThenShouldCallTheRepositoryToUpdateTheStatus()
        {
            await Handler.Handle(ExampleValidRequest);

            MockApprenticeshipRespository.Verify(x => x.ResumeApprenticeship(
                                                     It.Is <long>(a => a == 123L),
                                                     It.Is <long>(a => a == ExampleValidRequest.ApprenticeshipId)));
        }
        public async Task ThenShouldCallTheRepositoryToUpdateTheStatus()
        {
            await Handler.Handle(ExampleValidRequest);

            MockApprenticeshipRespository.Verify(x => x.StopApprenticeship(
                                                     It.Is <long>(a => a == 123L),
                                                     It.Is <long>(a => a == ExampleValidRequest.ApprenticeshipId),
                                                     It.Is <DateTime>(a => a == ExampleValidRequest.DateOfChange),
                                                     It.IsAny <bool?>()));
        }
        public async Task ThenShouldCallTheRepositoryToUpdateTheStatus_WithRedundancyStatus(bool madeRedundant)
        {
            ExampleValidRequest.MadeRedundant = madeRedundant;

            await Handler.Handle(ExampleValidRequest);

            MockApprenticeshipRespository.Verify(x => x.StopApprenticeship(
                                                     It.Is <long>(a => a == 123L),
                                                     It.Is <long>(a => a == ExampleValidRequest.ApprenticeshipId),
                                                     It.Is <DateTime>(a => a == ExampleValidRequest.DateOfChange), madeRedundant));
        }
        public async Task ThenShouldCallTheRepositoryToUpdateTheStatus()
        {
            MockCommitmentRespository.Setup(x => x.GetCommitmentById(It.IsAny <long>())).ReturnsAsync(new Commitment
            {
                Id = 123L,
                EmployerAccountId = ExampleValidRequest.AccountId
            });

            await Handler.Handle(ExampleValidRequest);

            MockApprenticeshipRespository.Verify(x => x.PauseOrResumeApprenticeship(
                                                     It.Is <long>(a => a == 123L),
                                                     It.Is <long>(a => a == ExampleValidRequest.ApprenticeshipId),
                                                     It.Is <PaymentStatus>(a => a == PaymentStatus.Active)));
        }