예제 #1
0
        public void ShouldShowSubmittedCount(int submittingCount, int submittedCount, bool shouldShow)
        {
            // Arrange.
            var apprenticeships = DashboardTestsHelper.GetApprenticeships(submittingCount,
                                                                          ApplicationStatuses.Submitting);

            apprenticeships.AddRange(DashboardTestsHelper.GetApprenticeships(submittedCount,
                                                                             ApplicationStatuses.Submitted));

            var myApplications = new MyApplicationsViewModelBuilder().With(apprenticeships).Build();

            // Act.
            var view = new MyApplications_().RenderAsHtml(myApplications);

            // Assert.
            var elem = view.GetElementbyId("submitted-applications-count");

            if (shouldShow)
            {
                elem.Should().NotBeNull();
                elem.InnerHtml.Should().Be(Convert.ToString(
                                               submittingCount + submittedCount));
            }
            else
            {
                elem.Should().BeNull();
            }
        }
        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 UnsuccessfulApplications()
        {
            var viewModel = new MyApplicationsViewModelBuilder().With(DashboardTestsHelper.GetApprenticeships(1, ApplicationStatuses.Unsuccessful, "Not eligible for working in UK")).Build();

            var result = new MyApplicationsViewBuilder().With(viewModel).Render();

            var dashUnsuccessful = result.GetElementbyId("dashUnsuccessful");

            dashUnsuccessful.Should().NotBeNull();

            var submittedTable = dashUnsuccessful.NextSibling.NextSibling.NextSibling.NextSibling;
            var submittedRow   = submittedTable.ChildNodes.FindFirst("tbody").ChildNodes.FindFirst("tr");
            var submittedCells = submittedRow.ChildNodes.Where(n => n.Name == "td").ToList();

            submittedCells.Count.Should().Be(3);

            var title           = submittedCells[0].ChildNodes.FindFirst("a");
            var viewApplication = submittedCells[1].ChildNodes.FindFirst("a");
            var submittedDate   = submittedCells[2].InnerText;

            title.Should().NotBeNull();
            viewApplication.Should().NotBeNull();
            submittedDate.Should().NotBeNull();

            var href = viewApplication.Attributes.First(a => a.Name == "href");

            href.Value.Should().Be("/apprenticeship/candidateapplicationfeedback/" + viewModel.UnsuccessfulApplications.First().VacancyId);
            viewApplication.InnerText.Should().Be("Read feedback");
        }
        public void SubmittedApplications()
        {
            var viewModel = new MyApplicationsViewModelBuilder().With(DashboardTestsHelper.GetApprenticeships(1, ApplicationStatuses.Submitted)).Build();

            var result = new MyApplicationsViewBuilder().With(viewModel).Render();

            var dashSubmitted = result.GetElementbyId("dashSubmitted");

            dashSubmitted.Should().NotBeNull();

            var submittedTable = dashSubmitted.NextSibling.NextSibling;
            var submittedRow   = submittedTable.ChildNodes.FindFirst("tbody").ChildNodes.FindFirst("tr");
            var submittedCells = submittedRow.ChildNodes.Where(n => n.Name == "td").ToList();

            submittedCells.Count.Should().Be(3);

            var title           = submittedCells[0].ChildNodes.FindFirst("a");
            var viewApplication = submittedCells[1].ChildNodes.FindFirst("a");
            var submittedDate   = submittedCells[2].InnerText;

            title.Should().NotBeNull();
            viewApplication.Should().NotBeNull();
            submittedDate.Should().NotBeNull();

            var href = viewApplication.Attributes.First(a => a.Name == "href");

            href.Value.Should().Be("/apprenticeship/view/" + viewModel.SubmittedApprenticeshipApplications.First().VacancyId);
            viewApplication.InnerText.Should().Be("View application");
        }
예제 #5
0
        public void ShouldNotShowCandidateSupportMessageWithExpiredApplications()
        {
            // Arrange.
            var myApplications =
                new MyApplicationsViewModelBuilder().With(DashboardTestsHelper.GetApprenticeships(1,
                                                                                                  ApplicationStatuses.ExpiredOrWithdrawn)).Build();

            // Act.
            var view = new Index().RenderAsHtml(myApplications);

            // Assert.
            var elem = view.GetElementbyId("candidate-support-message");

            elem.Should().BeNull();
        }
예제 #6
0
        public void ShouldShowCandidateSupportMessage()
        {
            // Arrange.
            var myApplications =
                new MyApplicationsViewModelBuilder().With(DashboardTestsHelper.GetApprenticeships(1,
                                                                                                  ApplicationStatuses.Unsuccessful)).Build();

            // Act.
            var view = new MyApplications_().RenderAsHtml(myApplications);

            // Assert.
            var elem = view.GetElementbyId("candidate-support-message");

            elem.Should().NotBeNull();
        }
        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);
            }
        }
예제 #8
0
        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();
            }
        }
예제 #9
0
        public void ShouldShowDraftCount(int draftCount, bool shouldShow)
        {
            // Arrange.
            var myApplications =
                new MyApplicationsViewModelBuilder().With(DashboardTestsHelper.GetApprenticeships(draftCount,
                                                                                                  ApplicationStatuses.Draft)).Build();

            // Act.
            var view = new MyApplications_().RenderAsHtml(myApplications);

            // Assert.
            var elem = view.GetElementbyId("draft-applications-count");

            if (shouldShow)
            {
                elem.Should().NotBeNull();
                elem.InnerHtml.Should().Be(Convert.ToString(draftCount));
            }
            else
            {
                elem.Should().BeNull();
            }
        }