Esempio n. 1
0
        public void Ok()
        {
            var candidateId = Guid.NewGuid();
            var apprenticeshipApplicationProvider = new Mock <IApprenticeshipApplicationProvider>();

            apprenticeshipApplicationProvider.Setup(p => p.GetApplicationViewModel(candidateId, ValidVacancyId))
            .Returns(new ApprenticeshipApplicationViewModelBuilder().WithVacancyStatus(VacancyStatuses.Live).Build());
            var mediator =
                new ApprenticeshipApplicationMediatorBuilder().With(apprenticeshipApplicationProvider).Build();

            var response = mediator.View(candidateId, ValidVacancyId);

            response.AssertCode(ApprenticeshipApplicationMediatorCodes.View.Ok, true);
        }
Esempio n. 2
0
        public void VacancyNotFound()
        {
            var viewModel =
                new ApprenticeshipApplicationViewModelBuilder().WithStatus(ApplicationStatuses.ExpiredOrWithdrawn)
                .Build();
            var apprenticeshipApplicationProvider = new Mock <IApprenticeshipApplicationProvider>();

            apprenticeshipApplicationProvider.Setup(p => p.GetApplicationViewModel(It.IsAny <Guid>(), It.IsAny <int>()))
            .Returns(viewModel);
            var mediator =
                new ApprenticeshipApplicationMediatorBuilder().With(apprenticeshipApplicationProvider).Build();

            var response = mediator.View(Guid.NewGuid(), ValidVacancyId);

            //Should still be able to view the application even if the vacancy is not available
            response.AssertCode(ApprenticeshipApplicationMediatorCodes.View.Ok, true);
        }
Esempio n. 3
0
        public void ApplicationNotFound()
        {
            var viewModel =
                new ApprenticeshipApplicationViewModelBuilder().HasError(
                    ApplicationViewModelStatus.ApplicationNotFound, MyApplicationsPageMessages.ApplicationNotFound)
                .Build();
            var apprenticeshipApplicationProvider = new Mock <IApprenticeshipApplicationProvider>();

            apprenticeshipApplicationProvider.Setup(p => p.GetApplicationViewModel(It.IsAny <Guid>(), It.IsAny <int>()))
            .Returns(viewModel);
            var mediator =
                new ApprenticeshipApplicationMediatorBuilder().With(apprenticeshipApplicationProvider).Build();

            var response = mediator.View(Guid.NewGuid(), ValidVacancyId);

            //Should still be able to view the application even if the vacancy is not available
            response.AssertMessage(ApprenticeshipApplicationMediatorCodes.View.ApplicationNotFound,
                                   ApplicationPageMessages.ViewApplicationFailed, UserMessageLevel.Warning, true);
        }