Ejemplo n.º 1
0
        public void ShouldReturnNoVacancyIdIfNoVacancyGuidIsSuppliedOnConfirmUnsuccessfulDecision()
        {
            var logService = new Mock <ILogService>();
            var mediator   = new ApprenticeshipApplicationMediator(null, null, null, null, logService.Object);

            var viewModel = new ApplicationSelectionViewModel(new VacancyApplicationsSearchViewModel(), Guid.Empty);

            var respone = mediator.ConfirmUnsuccessfulDecision(viewModel);

            respone.AssertCodeAndMessage(ApprenticeshipApplicationMediatorCodes.ConfirmUnsuccessfulDecision.NoApplicationId, false, false);
            logService.Verify(l => l.Error("Confirm unsuccessful decision failed: VacancyGuid is empty."));
        }
Ejemplo n.º 2
0
        public void ShouldReturnNoVacancyIdIfNoVacancyGuidIsSuppliedOnReview()
        {
            var logService = new Mock <ILogService>();
            var mediator   = new ApprenticeshipApplicationMediator(null, null, null, null, logService.Object);

            var viewModel = new ApplicationSelectionViewModel(new VacancyApplicationsSearchViewModel(), Guid.Empty);

            var respone = mediator.Review(viewModel);

            respone.AssertCodeAndMessage(ApprenticeshipApplicationMediatorCodes.Review.NoApplicationId, false, false);
            logService.Verify(l => l.Info("Review vacancy failed: VacancyGuid is empty."));
        }
Ejemplo n.º 3
0
        public void ShouldUpdateCommentsWhenSettingStatusToSubmitted()
        {
            // Arrange
            var mockApplicationProvider = new Mock <IApplicationProvider>();
            var mockValidator           = new Mock <ApprenticeshipApplicationViewModelServerValidator>();
            var mediator = new ApprenticeshipApplicationMediator(mockApplicationProvider.Object, mockValidator.Object, null, null, null);

            var viewModel = new Fixture().Build <ApprenticeshipApplicationViewModel>()
                            .With(vm => vm.Status, ApplicationStatuses.Submitted).Create();

            mockValidator.Setup(m => m.Validate(viewModel)).Returns(new ValidationResult());

            // Act
            var response = mediator.ReviewSetToSubmitted(viewModel);

            //Assert
            response.ViewModel.Status.Should().Be(ApplicationStatuses.Submitted);
            response.AssertCodeAndMessage(ApprenticeshipApplicationMediatorCodes.ReviewSaveAndContinue.Ok, false, false);
            mockApplicationProvider.Verify(m => m.SetStateSubmitted(viewModel.ApplicationSelection), Times.Once);
            mockApplicationProvider.Verify(m => m.UpdateApprenticeshipApplicationViewModelNotes(viewModel.ApplicationSelection.ApplicationId, viewModel.Notes, false), Times.Once);
        }