public void ShouldNotShowAnyNavigationDetailsIfOnlyOnePage()
        {
            var providerDetails = new ProviderDetail();
            var model           = GetProvider();
            var html            = providerDetails.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, "#previous-nav").Should().Be(string.Empty);
            GetPartial(html, "#next-nav").Should().Be(string.Empty);
        }
        public void ShouldShowNoTradingNamesFieldIfNoTradingNames()
        {
            var providerDetails = new ProviderDetail();
            var model           = GetProvider();

            model.TradingNames = string.Empty;
            var html = providerDetails.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, "#trading-names").Should().Be(string.Empty);
        }
        public void ShouldShowNoNationalFieldIfNationalIsFalse()
        {
            var providerDetails = new ProviderDetail();
            var model           = GetProvider();

            model.NationalProvider = false;
            var html = providerDetails.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, ".tag-national").Should().Be(string.Empty);
        }
        public void ShouldShowLearnerSatisfactionIf0()
        {
            var providerDetails = new ProviderDetail();
            var model           = GetProvider();

            model.LearnerSatisfaction        = NoSatisfactionScore;
            model.LearnerSatisfactionMessage = NoSatisfactionScoreMessage;
            var html = providerDetails.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, "#learner-satisfaction").Should().Be(NoSatisfactionScoreMessage);
        }
        public void ShouldShowEmployerSatisfactionIfNot0()
        {
            var providerDetails = new ProviderDetail();
            var model           = GetProvider();

            model.EmployerSatisfaction        = SatisfactionScore;
            model.EmployerSatisfactionMessage = SatisfactionScoreMessage;
            var html = providerDetails.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, "#employer-satisfaction").Should().Contain(SatisfactionScoreMessage);
        }
        public void ShouldShowAboutThisProviderIfNoTradingNamesIsSet()
        {
            var providerDetails = new ProviderDetail();
            var model           = GetProvider();

            model.TradingNames             = string.Empty;
            model.DisplayAboutThisProvider = true;

            var html = providerDetails.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, "#about-this-provider").Should().Contain("About this provider");
        }
        public void ShouldNotShowSourceIfNoSatisfactionScores()
        {
            var providerDetails = new ProviderDetail();
            var model           = GetProvider();

            model.LearnerSatisfaction        = NoSatisfactionScore;
            model.LearnerSatisfactionMessage = NoSatisfactionScoreMessage;

            var html = providerDetails.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, ".satisfaction-source").Should().Be(string.Empty);
        }
        public void ShouldShowIsLevyPayerOnlyMessageIfSet()
        {
            var providerDetails = new ProviderDetail();
            var model           = GetProvider();

            model.HasParentCompanyGuarantee = false;
            model.IsLevyPayerOnly           = true;
            model.IsNew = false;

            var html = providerDetails.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, "#parent-company-guarantee").Should().Be(string.Empty);
            GetPartial(html, "#is-new-provider").Should().Be(string.Empty);
        }
        public void ShouldShowFieldsAsExpected()
        {
            var providerDetails = new ProviderDetail();
            var model           = GetProvider();

            var html = providerDetails.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, "#provider-name").Should().Contain(ProviderName);
            GetPartial(html, ".tag-national").Should().Contain("National");
            GetPartial(html, "#trading-names").Should().Contain(TradingNames);
            GetPartial(html, ".data-list--provider").Should().Contain(UkPrn.ToString());

            GetPartial(html, ".apprenticeshipContact").Should().Contain(ProviderName + " website");
            GetAttribute(html, ".apprenticeshipContact", "href").Should().Be(Website, "because http be added if missing");
            GetPartial(html, ".phone").Should().Contain(model.Phone);
            GetPartial(html, ".email").Should().Contain(model.Email);
            GetPartial(html, "#employer-satisfaction").Should().Be(NoSatisfactionScoreMessage);
            GetPartial(html, "#learner-satisfaction").Should().Contain(SatisfactionScoreMessage);
            GetPartial(html, ".satisfaction-source").Should().Contain("Source:");
        }
        public void ShouldShowOnlyPreviousNavigationDetailsIfLastPage()
        {
            var providerDetails = new ProviderDetail();
            var model           = GetProvider();

            model.ApprenticeshipTrainingSummary.PaginationDetails
                = new PaginationDetails
                {
                LastPage = 4,
                NumberOfRecordsToSkip = 60,
                NumberPerPage         = 20,
                TotalCount            = 69,
                Page = 4
                };

            var html = providerDetails.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, "#previous-nav").Should().Contain("3 of 4");
            GetPartial(html, "#next-nav").Should().Be(string.Empty);
        }
        public void ShouldShowOnlyNextNavigationDetailsIfMoreThanOnePageAndOnFirstPage()
        {
            var providerDetails = new ProviderDetail();
            var model           = GetProvider();

            model.ApprenticeshipTrainingSummary.PaginationDetails
                = new PaginationDetails
                {
                LastPage = 2,
                NumberOfRecordsToSkip = 0,
                NumberPerPage         = 20,
                TotalCount            = 1,
                Page = 1
                };

            var html = providerDetails.RenderAsHtml(model).ToAngleSharp();

            GetPartial(html, "#previous-nav").Should().Be(string.Empty);
            GetPartial(html, "#next-nav").Should().Contain("2 of 2");
        }