public void ShowTraineeships(int traineeshipCount, bool shouldShow) { // Arrange. var myApplications = new MyApplicationsViewModelBuilder().With(DashboardTestsHelper.GetTraineeships(traineeshipCount)).Build(); // Act. var view = new MyApplications_().RenderAsHtml(myApplications); // Assert. var traineeshipsCount = view.GetElementbyId("traineeship-applications-count"); var traineeshipsTable = view.GetElementbyId("dashTraineeships"); if (shouldShow) { traineeshipsCount.Should().NotBeNull(); traineeshipsCount.InnerHtml.Should().Be(Convert.ToString(traineeshipCount)); traineeshipsTable.Should().NotBeNull(); } else { traineeshipsCount.Should().BeNull(); traineeshipsTable.Should().BeNull(); } }
public void ShowViewTraineeshipLink() { // Arrange. var myApplications = new MyApplicationsViewModelBuilder().With(DashboardTestsHelper.GetTraineeships(3)).Build(); // Act. var view = new MyApplications_().RenderAsHtml(myApplications); // Assert. foreach (var application in myApplications.TraineeshipApplications) { var id = string.Format("traineeship-view-link-{0}", application.VacancyId); var url = string.Format("traineeship/view/{0}", application.VacancyId); var viewTraineeshipLink = view.GetElementbyId(id); viewTraineeshipLink.Should().NotBeNull(); viewTraineeshipLink.OuterHtml.Should().Contain(url); } }
public void ShouldShowFindApprenticeshipLink(int apprenticeshipCount, int traineeshipCount, bool shouldShow) { // Arrange. var myApplications = new MyApplicationsViewModelBuilder().With(DashboardTestsHelper.GetApprenticeships(apprenticeshipCount)) .With(DashboardTestsHelper.GetTraineeships(traineeshipCount)) .Build(); // Act. var view = new Index().RenderAsHtml(myApplications); var elem = view.GetElementbyId("find-apprenticeship-link"); // Assert. if (shouldShow) { elem.Should().NotBeNull(); } else { elem.Should().BeNull(); } }