public ActionResult Index() { var model = new CourseLandingViewModel(); AddWidgetProperties(model); return(View("Index", model)); }
public ActionResult Index(CourseLandingViewModel model) { if (model == null) { return(Redirect(CourseSearchResultsPage)); } return(Redirect(buildQueryStringService.BuildRedirectPathAndQueryString(CourseSearchResultsPage, model.SearchTerm, model))); }
private void AddWidgetProperties(CourseLandingViewModel model) { model.CourseNameHintText = CourseNameHintText; model.CourseNameLabel = CourseNameLabel; model.LocationLabel = LocationLabel; model.ProviderLabel = ProviderLabel; model.ProviderNameHintText = ProviderHintText; model.LocationHintText = LocationHintText; model.SubmitButtonText = SubmitButtonText; }
private void AddWidgetProperties(CourseLandingViewModel model) { model.CourseNameHintText = CourseNameHintText; model.CourseNameLabel = CourseNameLabel; model.LocationLabel = LocationLabel; model.ProviderLabel = ProviderLabel; model.ProviderNameHintText = ProviderHintText; model.LocationHintText = LocationHintText; model.Dfe1619FundedText = Dfe1619FundedText; }
public void Dfc7053CourseLandingViewTests() { // Arrange var courseLandingIndex = new _MVC_Views_CourseLanding_Index_cshtml(); var courseLandingViewModel = new CourseLandingViewModel { SearchTerm = nameof(CourseLandingViewModel.SearchTerm) }; // Act var htmlDocument = courseLandingIndex.RenderAsHtml(courseLandingViewModel); // Assert this.AssertFormGroupsCounts(htmlDocument, 5); }
public void SubmitTests(string courseName) { // Assign var postModel = new CourseLandingViewModel { SearchTerm = courseName }; var controller = new CourseLandingController(fakeApplicationLogger, fakeBuildQueryStringService); A.CallTo(() => fakeBuildQueryStringService.BuildPathAndQueryString(controller.CourseSearchResultsPage, postModel)).Returns(controller.CourseSearchResultsPage); // Act var controllerResult = controller.WithCallTo(contrl => contrl.Index(postModel)); // Assert controllerResult.ShouldRedirectTo( fakeBuildQueryStringService.BuildPathAndQueryString(controller.CourseSearchResultsPage, postModel)); }
public void BuildSearchRedirectPathAndQueryStringTest(string courseSearchResultsPage, CourseLandingViewModel courseLandingViewModel, string expectedPathAndQuery) { //Assign var buildQueryStringService = new BuildQueryStringService(); //Act var result = buildQueryStringService.BuildRedirectPathAndQueryString(courseSearchResultsPage, courseLandingViewModel.SearchTerm, courseLandingViewModel); //Assert result.Should().BeEquivalentTo(expectedPathAndQuery); }
public static void BuildSearchRedirectBuildPathAndQueryStringTest(string courseSearchResultsPage, CourseLandingViewModel courseLandingViewModel, string expectedPathAndQuery) { courseLandingViewModel = courseLandingViewModel ?? new CourseLandingViewModel(); //Assign var buildQueryStringService = new QueryStringBuilder(); //Act var result = buildQueryStringService.BuildPathAndQueryString(courseSearchResultsPage, courseLandingViewModel); //Assert result.Should().BeEquivalentTo(expectedPathAndQuery); }