示例#1
0
        public void GetVacancySummaryViewModelShoudReturnOkIfValidationPassed()
        {
            const int vacancyReferenceNumber = 1;
            var       vacancyProvider        = new Mock <IVacancyQAProvider>();

            vacancyProvider.Setup(vp => vp.GetVacancySummaryViewModel(vacancyReferenceNumber)).Returns(GetValidVacancySummaryViewModel(vacancyReferenceNumber));

            var mediator = new VacancyMediatorBuilder().With(vacancyProvider).Build();

            var response = mediator.GetVacancySummaryViewModel(vacancyReferenceNumber);

            response.AssertCodeAndMessage(VacancyMediatorCodes.GetVacancySummaryViewModel.Ok);
        }
示例#2
0
        public void GetVacancySummaryViewModelShoudReturnValidationFailedIfValidationFailed()
        {
            const int vacancyReferenceNumber = 1;
            var       vacancyPostingProvider = new Mock <IVacancyQAProvider>();

            vacancyPostingProvider.Setup(vp => vp.GetVacancySummaryViewModel(vacancyReferenceNumber)).Returns(new FurtherVacancyDetailsViewModel
            {
                VacancyDatesViewModel = new VacancyDatesViewModel
                {
                    ClosingDate       = new DateViewModel(DateTime.UtcNow),
                    PossibleStartDate = new DateViewModel(DateTime.UtcNow)
                },
                Wage = new WageViewModel()
                {
                    Type = WageType.ApprenticeshipMinimum, Classification = WageClassification.ApprenticeshipMinimum, Amount = null, AmountLowerBound = null, AmountUpperBound = null, Text = null, Unit = WageUnit.NotApplicable, HoursPerWeek = null
                }
            });

            var mediator = new VacancyMediatorBuilder().With(vacancyPostingProvider).Build();

            var response = mediator.GetVacancySummaryViewModel(vacancyReferenceNumber);

            response.AssertValidationResult(VacancyMediatorCodes.GetVacancySummaryViewModel.FailedValidation);
        }