コード例 #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();
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        public MyApplications_ Build()
        {
            var view = new MyApplications_ {
                ViewData = { Model = _viewModel }
            };

            return(view);
        }
コード例 #4
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();
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        public void ShouldShowFindApprenticeshipButton(int apprenticeshipCount, int traineeshipCount, bool shouldShow)
        {
            var myApplications =
                new MyApplicationsViewModelBuilder().With(DashboardTestsHelper.GetApprenticeships(apprenticeshipCount))
                .With(DashboardTestsHelper.GetTraineeships(traineeshipCount))
                .Build();

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

            // Assert.
            var elem = view.GetElementbyId("find-apprenticeship-button");

            if (shouldShow)
            {
                elem.Should().NotBeNull();
            }
            else
            {
                elem.Should().BeNull();
            }
        }
コード例 #7
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();
            }
        }