Exemple #1
0
        public void ShouldReturnTheViewModelAndAMessageIfTheVacancySourceIsNotRaa(VacancySource vacancySource, string code, string message)
        {
            const int vacancyReferenceNumber = 1;
            var viewModel = VacancyMediatorTestHelper.GetValidVacancyViewModel(vacancyReferenceNumber, vacancySource);

            var provider = new Mock<IVacancyQAProvider>();

            provider.Setup(p => p.ReviewVacancy(vacancyReferenceNumber)).Returns(viewModel);

            var validator = new Mock<VacancyViewModelValidator>();
            validator.Setup(v => v.Validate(It.IsAny<VacancyViewModel>()))
                .Returns(new ValidationResult());

            var mediator = new VacancyMediatorBuilder().With(validator).With(provider).Build();

            var result = mediator.ReviewVacancy(vacancyReferenceNumber);

            result.ViewModel.VacancyReferenceNumber.Should().Be(vacancyReferenceNumber);
            result.AssertMessage(code, 
                message,
                UserMessageLevel.Info);
        }
        public static VacancyViewModel GetValidVacancyViewModel(int vacancyReferenceNumber, VacancySource vacancySource)
        {
            var viewModel = GetValidVacancyViewModel(vacancyReferenceNumber);

            viewModel.VacancySource = vacancySource;

            return(viewModel);
        }