예제 #1
0
        public void WhenMadeRedundantConfirmedIsTrue_ThenValidatorReturnsValid(MadeRedundantViewModel viewModel)
        {
            viewModel.MadeRedundant = true;

            var result = _validator.Validate(viewModel);

            Assert.True(result.IsValid);
        }
예제 #2
0
        public void WhenMadeRedundantConfirmedIsNull_ThenValidatorReturnsInvalid(MadeRedundantViewModel viewModel)
        {
            viewModel.MadeRedundant = null;

            var result = _validator.Validate(viewModel);

            Assert.False(result.IsValid);
        }
예제 #3
0
        public async Task WhenRequesting_HasTheAppretniceBeenMadeRedundant_ThenMadeRedundantViewModelIsPassedToTheView(MadeRedundantViewModel expectedViewModel)
        {
            _mockModelMapper.Setup(m => m.Map <MadeRedundantViewModel>(It.IsAny <MadeRedundantRequest>()))
            .ReturnsAsync(expectedViewModel);

            var viewResult = await _controller.HasTheApprenticeBeenMadeRedundant(new MadeRedundantRequest()) as ViewResult;

            var viewModel = viewResult.Model;

            var actualViewModel = (MadeRedundantViewModel)viewModel;

            Assert.IsInstanceOf <MadeRedundantViewModel>(viewModel);
            Assert.AreEqual(expectedViewModel, actualViewModel);
        }
예제 #4
0
        public void AndTheUserAnswered_HasTheApprenticeBeenMadeRedundant_ThenRedirectToConfirmStopApprenticeship(MadeRedundantViewModel viewModel)
        {
            var result = _controller.HasTheApprenticeBeenMadeRedundant(viewModel);

            var redirect = result.VerifyReturnsRedirectToActionResult();

            Assert.AreEqual(redirect.ActionName, "ConfirmStop");
            Assert.AreEqual(redirect.RouteValues["AccountHashedId"], viewModel.AccountHashedId);
            Assert.AreEqual(redirect.RouteValues["ApprenticeshipHashedId"], viewModel.ApprenticeshipHashedId);
            Assert.AreEqual(redirect.RouteValues["StopMonth"], viewModel.StopMonth);
            Assert.AreEqual(redirect.RouteValues["StopYear"], viewModel.StopYear);
            Assert.AreEqual(redirect.RouteValues["IsCoPJourney"], viewModel.IsCoPJourney);
            Assert.AreEqual(redirect.RouteValues["MadeRedundant"], viewModel.MadeRedundant);
        }
예제 #5
0
 public IActionResult HasTheApprenticeBeenMadeRedundant(MadeRedundantViewModel viewModel)
 {
     return(RedirectToAction(nameof(ConfirmStop), new { viewModel.AccountHashedId, viewModel.ApprenticeshipHashedId, viewModel.IsCoPJourney, viewModel.StopMonth, viewModel.StopYear, viewModel.MadeRedundant }));
 }