コード例 #1
0
        public void FailValidationEducationLongerThan15Char()
        {
            var viewModel = new TraineeshipApplicationViewModel
            {
                Candidate = new TraineeshipCandidateViewModel
                {
                    MonitoringInformation = new MonitoringInformationViewModel(),
                    HasQualifications     = true,
                    Qualifications        = new List <QualificationsViewModel>
                    {
                        new QualificationsViewModel
                        {
                            Grade             = "Grade is Longer than 15 chars",
                            QualificationType = "QUAL",
                            Year = "2012"
                        }
                    }
                }
            };

            TraineeshipApplicationProvider.Setup(p => p.GetApplicationViewModel(It.IsAny <Guid>(), ValidVacancyId))
            .Returns(viewModel);
            TraineeshipApplicationProvider.Setup(
                p =>
                p.PatchApplicationViewModel(It.IsAny <Guid>(), It.IsAny <TraineeshipApplicationViewModel>(),
                                            It.IsAny <TraineeshipApplicationViewModel>()))
            .Returns <Guid, TraineeshipApplicationViewModel, TraineeshipApplicationViewModel>((cid, svm, vm) => vm);

            var response = Mediator.Submit(Guid.NewGuid(), ValidVacancyId, viewModel);

            response.AssertValidationResult(TraineeshipApplicationMediatorCodes.Submit.ValidationError, true, false);
        }
コード例 #2
0
        public void SubmitApplicationError()
        {
            var viewModel = new TraineeshipApplicationViewModel
            {
                Candidate       = new TraineeshipCandidateViewModel(),
                VacancyDetail   = new TraineeshipVacancyDetailViewModel(),
                ViewModelStatus = ApplicationViewModelStatus.Error
            };

            TraineeshipApplicationProvider.Setup(p => p.GetApplicationViewModel(It.IsAny <Guid>(), ValidVacancyId))
            .Returns(new TraineeshipApplicationViewModel {
                ViewModelStatus = ApplicationViewModelStatus.Error
            });
            TraineeshipApplicationProvider.Setup(
                p =>
                p.PatchApplicationViewModel(It.IsAny <Guid>(), It.IsAny <TraineeshipApplicationViewModel>(),
                                            It.IsAny <TraineeshipApplicationViewModel>()))
            .Returns <Guid, TraineeshipApplicationViewModel, TraineeshipApplicationViewModel>((cid, svm, vm) => vm);
            TraineeshipApplicationProvider.Setup(
                p => p.SubmitApplication(It.IsAny <Guid>(), It.IsAny <int>(), It.IsAny <TraineeshipApplicationViewModel>()))
            .Returns <Guid, int, TraineeshipApplicationViewModel>((cid, vid, vm) => vm);

            var response = Mediator.Submit(Guid.NewGuid(), ValidVacancyId, viewModel);

            response.AssertMessage(TraineeshipApplicationMediatorCodes.Submit.Error,
                                   ApplicationPageMessages.SubmitApplicationFailed, UserMessageLevel.Warning, true, true);
        }
コード例 #3
0
        public void FailValidation()
        {
            var viewModel = new TraineeshipApplicationViewModel
            {
                Candidate = new TraineeshipCandidateViewModel
                {
                    MonitoringInformation = new MonitoringInformationViewModel
                    {
                        AnythingWeCanDoToSupportYourInterview = new string('X', 9999)
                    }
                }
            };

            TraineeshipApplicationProvider.Setup(p => p.GetApplicationViewModel(It.IsAny <Guid>(), ValidVacancyId))
            .Returns(viewModel);
            TraineeshipApplicationProvider.Setup(
                p =>
                p.PatchApplicationViewModel(It.IsAny <Guid>(), It.IsAny <TraineeshipApplicationViewModel>(),
                                            It.IsAny <TraineeshipApplicationViewModel>()))
            .Returns <Guid, TraineeshipApplicationViewModel, TraineeshipApplicationViewModel>((cid, svm, vm) => vm);

            var response = Mediator.Submit(Guid.NewGuid(), ValidVacancyId, viewModel);

            response.AssertValidationResult(TraineeshipApplicationMediatorCodes.Submit.ValidationError, true, false);
        }
コード例 #4
0
        public void IncorrectState()
        {
            var viewModel = new TraineeshipApplicationViewModel
            {
                Candidate       = new TraineeshipCandidateViewModel(),
                VacancyDetail   = new TraineeshipVacancyDetailViewModel(),
                ViewModelStatus = ApplicationViewModelStatus.ApplicationInIncorrectState
            };

            TraineeshipApplicationProvider.Setup(p => p.GetApplicationViewModel(It.IsAny <Guid>(), ValidVacancyId))
            .Returns(new TraineeshipApplicationViewModel
            {
                ViewModelStatus = ApplicationViewModelStatus.ApplicationInIncorrectState
            });
            TraineeshipApplicationProvider.Setup(
                p =>
                p.PatchApplicationViewModel(It.IsAny <Guid>(), It.IsAny <TraineeshipApplicationViewModel>(),
                                            It.IsAny <TraineeshipApplicationViewModel>()))
            .Returns <Guid, TraineeshipApplicationViewModel, TraineeshipApplicationViewModel>((cid, svm, vm) => vm);
            TraineeshipApplicationProvider.Setup(
                p => p.SubmitApplication(It.IsAny <Guid>(), It.IsAny <int>(), It.IsAny <TraineeshipApplicationViewModel>()))
            .Returns <Guid, int, TraineeshipApplicationViewModel>((cid, vid, vm) => vm);

            var response = Mediator.Submit(Guid.NewGuid(), ValidVacancyId, viewModel);

            response.AssertCode(TraineeshipApplicationMediatorCodes.Submit.IncorrectState, false);
        }
コード例 #5
0
ファイル: ApplyTests.cs プロジェクト: Valtech-NAS/Beta
        public void Ok()
        {
            TraineeshipApplicationProvider.Setup(p => p.GetApplicationViewModel(It.IsAny <Guid>(), ValidVacancyId)).Returns(new TraineeshipApplicationViewModel());

            var response = Mediator.Apply(Guid.NewGuid(), ValidVacancyId.ToString());

            response.AssertCode(TraineeshipApplicationMediatorCodes.Apply.Ok, true);
        }
コード例 #6
0
ファイル: ApplyTests.cs プロジェクト: Valtech-NAS/Beta
        public void HasError()
        {
            TraineeshipApplicationProvider.Setup(p => p.GetApplicationViewModel(It.IsAny <Guid>(), InvalidVacancyId)).Returns(new TraineeshipApplicationViewModel("Vacancy not found"));

            var response = Mediator.Apply(Guid.NewGuid(), InvalidVacancyId.ToString());

            response.AssertCode(TraineeshipApplicationMediatorCodes.Apply.HasError, false);
        }
コード例 #7
0
        public void Ok()
        {
            TraineeshipApplicationProvider.Setup(p => p.GetWhatHappensNextViewModel(It.IsAny <Guid>(), It.IsAny <int>())).Returns(new WhatHappensNextViewModel());

            var response = Mediator.WhatHappensNext(_someCandidateId, SomeVacancyId.ToString(), VacancyReference, VacancyTitle);

            response.AssertCode(TraineeshipApplicationMediatorCodes.WhatHappensNext.Ok, true);
        }
コード例 #8
0
        public void VacancyNotFound()
        {
            TraineeshipApplicationProvider.Setup(p => p.GetWhatHappensNextViewModel(It.IsAny <Guid>(), It.IsAny <int>())).Returns(new WhatHappensNextViewModel {
                Status = ApplicationStatuses.ExpiredOrWithdrawn
            });

            var response = Mediator.WhatHappensNext(_someCandidateId, SomeVacancyId.ToString(), VacancyReference, VacancyTitle);

            response.AssertCode(TraineeshipApplicationMediatorCodes.WhatHappensNext.VacancyNotFound, false);
        }
コード例 #9
0
        public void GetApplicationViewModelError()
        {
            var getApplicationViewModel = new TraineeshipApplicationViewModelBuilder().WithMessage(ApplicationPageMessages.SubmitApplicationFailed).Build();

            TraineeshipApplicationProvider.Setup(p => p.GetApplicationViewModel(It.IsAny <Guid>(), ValidVacancyId)).Returns(getApplicationViewModel);

            var viewModel = new TraineeshipApplicationViewModelBuilder().Build();
            var response  = Mediator.Submit(Guid.NewGuid(), ValidVacancyId, viewModel);

            response.AssertMessage(TraineeshipApplicationMediatorCodes.Submit.Error, ApplicationPageMessages.SubmitApplicationFailed, UserMessageLevel.Warning, true, true);
        }
コード例 #10
0
        public void HasError()
        {
            TraineeshipApplicationProvider.Setup(p => p.GetWhatHappensNextViewModel(It.IsAny <Guid>(), It.IsAny <int>()))
            .Returns(new WhatHappensNextTraineeshipViewModel("Has Error"));

            var response = Mediator.WhatHappensNext(_someCandidateId,
                                                    SomeVacancyId.ToString(CultureInfo.InvariantCulture), VacancyReference, VacancyTitle);

            response.AssertCode(TraineeshipApplicationMediatorCodes.WhatHappensNext.Ok, true);
            var viewModel = response.ViewModel;

            viewModel.VacancyReference.Should().Be(VacancyReference);
            viewModel.VacancyTitle.Should().Be(VacancyTitle);
        }
コード例 #11
0
        public void OkIsJavascript()
        {
            var viewModel = new TraineeshipApplicationViewModel
            {
                Candidate     = new TraineeshipCandidateViewModel(),
                VacancyDetail = new VacancyDetailViewModel(),
                IsJavascript  = true
            };

            TraineeshipApplicationProvider.Setup(p => p.GetApplicationViewModel(It.IsAny <Guid>(), ValidVacancyId)).Returns(new TraineeshipApplicationViewModel());
            TraineeshipApplicationProvider.Setup(p => p.PatchApplicationViewModel(It.IsAny <Guid>(), It.IsAny <TraineeshipApplicationViewModel>(), It.IsAny <TraineeshipApplicationViewModel>())).Returns <Guid, TraineeshipApplicationViewModel, TraineeshipApplicationViewModel>((cid, svm, vm) => vm);
            TraineeshipApplicationProvider.Setup(p => p.SubmitApplication(It.IsAny <Guid>(), It.IsAny <int>(), It.IsAny <TraineeshipApplicationViewModel>())).Returns <Guid, int, TraineeshipApplicationViewModel>((cid, vid, vm) => vm);

            var response = Mediator.Submit(Guid.NewGuid(), ValidVacancyId, viewModel);

            response.AssertCode(TraineeshipApplicationMediatorCodes.Submit.Ok, false, true);
        }