public void ShouldShowGeneralMessageWhenSeveralResultsAreReturnedInAllCountry() { var detail = new FrameworkSearchResultMessage(); var model = new ProviderFrameworkSearchResultViewModel { Title = "Test name: Pathway test name", TotalResults = 7, PostCodeMissing = false, FrameworkId = "1", FrameworkCode = 2, FrameworkLevel = 2, FrameworkName = "Test name", PathwayName = "Pathway test name", Hits = new List <FrameworkProviderResultItemViewModel>(), HasError = false, NationalProviders = new NationalProviderViewModel() { Count = 1 }, ShowAll = true }; var html = detail.RenderAsHtml(model).ToAngleSharp(); GetPartial(html, ".result-message p").Should().Contain("There are 7 training options for the Test name: Pathway test name, level 2 apprenticeship in England."); }
public void ShouldShowIndividualMessageWhenJustOneResultIsReturnedAndThereIsNoLevel() { var detail = new FrameworkSearchResultMessage(); var model = new ProviderFrameworkSearchResultViewModel { Title = "Test name: Pathway test name", TotalResults = 1, PostCodeMissing = false, FrameworkId = "1", FrameworkCode = 2, FrameworkName = "Test name", PathwayName = "Pathway test name", Hits = new List <FrameworkProviderResultItemViewModel>(), HasError = false, NationalProviders = new NationalProviderViewModel() { Count = 1 } }; var html = detail.RenderAsHtml(model).ToAngleSharp(); GetPartial(html, ".result-message p").Should().Contain("There is 1 training option for the Test name: Pathway test name, level 0 apprenticeship."); GetPartial(html, "p").Should().Contain("There is 1 training option for the Test name: Pathway test name, level 0 apprenticeship."); }
public void ShouldShowAnErrorWhenSomethingIsWrong() { var detail = new FrameworkSearchResultMessage(); var model = new ProviderFrameworkSearchResultViewModel { TotalResults = 0, PostCodeMissing = false, FrameworkId = "1", FrameworkCode = 2, Hits = new List <FrameworkProviderResultItemViewModel>(), HasError = true }; var html = detail.RenderAsHtml(model).ToAngleSharp(); this.GetPartial(html, ".result-message p").Should().Contain("There was a problem performing a search. Try again later."); }
public void ShouldShowMessageInformingAboutNationalLabel() { var detail = new FrameworkSearchResultMessage(); var model = new ProviderFrameworkSearchResultViewModel { TotalResults = 7, PostCodeMissing = false, FrameworkId = "1", FrameworkName = "Test name", FrameworkLevel = 3, Hits = new List <FrameworkProviderResultItemViewModel>(), HasError = false, NationalProviders = new NationalProviderViewModel { Count = 1 }, ShowAll = true }; var html = detail.RenderAsHtml(model).ToAngleSharp(); GetPartial(html, "p", 3).Should().Contain("Results labelled National are training options run by providers who are willing to offer training across England."); }
public void WhenSearchResultHasNoResultAndTheraAreNoProvidersInCountryShouldntShowProvidersMessage() { var detail = new FrameworkSearchResultMessage(); var model = new ProviderFrameworkSearchResultViewModel { TotalResults = 0, PostCodeMissing = false, FrameworkId = "1", FrameworkName = "Test framework name", Hits = new List <FrameworkProviderResultItemViewModel>(), ActualPage = 1, LastPage = 1, ResultsToTake = 10, PostCode = "Test postcode", DeliveryModes = new List <DeliveryModeViewModel>(), HasError = false, TotalProvidersCountry = 0 }; var html = detail.RenderAsHtml(model).ToAngleSharp(); GetPartial(html, ".total-providers-country").Should().BeEmpty(); }
public void ShouldNotShowMessageInformingAboutNationalLabel(int totalResults, int nationalProviders) { var detail = new FrameworkSearchResultMessage(); var model = new ProviderFrameworkSearchResultViewModel { TotalResults = totalResults, PostCodeMissing = false, FrameworkId = "1", FrameworkName = "Test name", FrameworkLevel = 3, PostCode = "N17", Hits = new List <FrameworkProviderResultItemViewModel>(), HasError = false, NationalProviders = new NationalProviderViewModel { Count = nationalProviders }, ShowAll = true }; var html = detail.RenderAsHtml(model).ToAngleSharp(); GetPartial(html, "p", 2).Should().NotStartWith("Results labelled National are training providers"); GetPartial(html, "p", 3).Should().NotStartWith("Results labelled National are training providers"); GetPartial(html, "p", 3).Should().BeEmpty(); }