public void GivenIHaveNotChosenAStartDate()
        {
            var controller                      = Services.GetService <ReservationsController>();
            var trainingDateViewModel           = new TrainingDateViewModel(new TrainingDateModel());
            var apprenticeshipTrainingFormModel = new ApprenticeshipTrainingFormModel
            {
                StartDate = trainingDateViewModel.SerializedModel,
                AccountLegalEntityPublicHashedId = TestData.AccountLegalEntity.AccountLegalEntityPublicHashedId
            };

            TestData.ActionResult = controller.PostApprenticeshipTraining(TestData.ReservationRouteModel, apprenticeshipTrainingFormModel)
                                    .Result as ViewResult;
        }
        public void GivenIHaveAReservationStartDateOfAugust(string month)
        {
            TestData.BuildTrainingDateModel(month);

            var controller            = Services.GetService <ReservationsController>();
            var trainingDateViewModel = new TrainingDateViewModel(TestData.TrainingDate);

            var apprenticeshipTrainingFormModel = new ApprenticeshipTrainingFormModel
            {
                StartDate = trainingDateViewModel.SerializedModel,
                AccountLegalEntityPublicHashedId = TestData.AccountLegalEntity.AccountLegalEntityPublicHashedId
            };

            var result = controller.PostApprenticeshipTraining(TestData.ReservationRouteModel, apprenticeshipTrainingFormModel)
                         .Result as RedirectToRouteResult;

            Assert.IsNotNull(result);
            Assert.AreEqual(RouteNames.EmployerReview, result.RouteName);
        }
        public void WhenIChooseACourseAndDateOnBehalfOfAnEmployer(string month)
        {
            TestData.BuildTrainingDateModel(month);
            var trainingDateViewModel     = new TrainingDateViewModel(TestData.TrainingDate);
            var postSelectCourseViewModel = new ApprenticeshipTrainingFormModel
            {
                AccountLegalEntityPublicHashedId = TestData.ReservationRouteModel.AccountLegalEntityPublicHashedId,
                SelectedCourseId = TestData.Course.Id,
                StartDate        = trainingDateViewModel.SerializedModel
            };

            var controller = Services.GetService <ReservationsController>();

            var result = controller.PostApprenticeshipTraining(TestData.ReservationRouteModel, postSelectCourseViewModel)
                         .Result as RedirectToRouteResult;

            result.RouteName.Should().Be(RouteNames.ProviderReview);
            result.RouteValues["Id"].Should().Be(TestData.ReservationRouteModel.Id);
            result.RouteValues["UkPrn"].Should().Be(TestData.ReservationRouteModel.UkPrn);
        }
コード例 #4
0
        public void And_Null_StartDate_Then_Checked_Is_Null(TrainingDateModel model)
        {
            var viewModel = new TrainingDateViewModel(model);

            viewModel.Checked.Should().BeNull();
        }
コード例 #5
0
        public void Then_Sets_Checked(TrainingDateModel model)
        {
            var viewModel = new TrainingDateViewModel(model, true);

            viewModel.Checked.Should().Be("checked");
        }
コード例 #6
0
 public void Then_Sets_Label(
     [Frozen] TrainingDateModel model,
     TrainingDateViewModel viewModel)
 {
     viewModel.StartDate.Should().Be(model.StartDate);
 }
コード例 #7
0
 public void Then_Sets_Value(
     [Frozen] TrainingDateModel model,
     TrainingDateViewModel viewModel)
 {
     viewModel.SerializedModel.Should().Be(JsonConvert.SerializeObject(model));
 }
コード例 #8
0
 public void Then_Sets_Id(
     [Frozen] TrainingDateModel model,
     TrainingDateViewModel viewModel)
 {
     viewModel.Id.Should().Be($"{model.StartDate:yyyy-MM}");
 }