public CourseSearchResultLocationTests() { courseDetailsView = new _MVC_Views_CourseSearchResults_CourseDetail_cshtml(); courseListingViewModel = new CourseListingViewModel { LocationLabel = "LocationLabel", ProviderLabel = "ProviderLabel", AdvancedLoanProviderLabel = "AdvancedLoanProviderLabel", StartDateLabel = "StartDateLabel", Course = new Course() }; }
public void Dfc7055CourseDetailsViewTests( Course course, string providerLabel, string advancedLoanProviderLabel, string locationLabel, string startDateLabel) { // Assign var courseDetailsView = new _MVC_Views_CourseSearchResults_CourseDetail_cshtml(); var viewModel = new CourseListingViewModel { Course = course, ProviderLabel = providerLabel, AdvancedLoanProviderLabel = advancedLoanProviderLabel, LocationLabel = locationLabel, StartDateLabel = startDateLabel }; // Act var htmlDom = courseDetailsView.RenderAsHtml(viewModel); // Assert AssertTagInnerTextValue(htmlDom, viewModel.AdvancedLoanProviderLabel, "span"); AssertTagInnerTextValue(htmlDom, viewModel.ProviderLabel, "span"); if (!string.IsNullOrWhiteSpace(viewModel.Course.Location)) { AssertTagInnerTextValue(htmlDom, viewModel.LocationLabel, "span"); } else { AssertTagInnerTextValueDoesNotExist(htmlDom, viewModel.LocationLabel, "span"); } if (viewModel.Course.QualificationLevel.ToLowerInvariant().Contains("unknown")) { AssertTagInnerTextValueDoesNotExist(htmlDom, viewModel.Course.QualificationLevel, "li"); } else { AssertTagInnerTextValue(htmlDom, viewModel.Course.QualificationLevel, "li"); } }
public void Dfc7055CourseDetailsViewTests( Course course, string providerLabel, string advancedLoanProviderLabel, string locationLabel, string startDateLabel) { // Assign var courseDetailsView = new _MVC_Views_CourseSearchResults_CourseDetail_cshtml(); var viewModel = new CourseListingViewModel { Course = course, ProviderLabel = providerLabel, AdvancedLoanProviderLabel = advancedLoanProviderLabel, LocationLabel = locationLabel, StartDateLabel = startDateLabel }; // Act var htmlDom = courseDetailsView.RenderAsHtml(viewModel); // Assert // AssertTagInnerTextValue(htmlDom, viewModel.AdvancedLoanProviderLabel, "span"); AssertTagInnerTextValue(htmlDom, viewModel.ProviderLabel, "span"); if (viewModel.Course.LocationDetails != null) { AssertTagInnerTextValue(htmlDom, viewModel.LocationLabel, "span"); if (!viewModel.Course.LocationDetails.Distance.Equals(default(float))) { AssertTagInnerTextValue(htmlDom, "miles)", "li"); } } else { AssertTagInnerTextValueDoesNotExist(htmlDom, viewModel.LocationLabel, "span"); } }