public void ShouldShowAnErrorWhenSomethingIsWrong() { var detail = new StandardSearchResultMessage(); var model = new ProviderStandardSearchResultViewModel { TotalResults = 0, PostCodeMissing = false, StandardId = "1", Hits = new List <StandardProviderResultItemViewModel>(), HasError = true }; var html = detail.RenderAsHtml(model).ToAngleSharp(); GetPartial(html, "p").Should().Contain("There was a problem performing a search. Try again later."); }
public void ShouldShowIndividualMessageWhenJustOneResultIsReturnedInAllCountry() { var detail = new StandardSearchResultMessage(); var model = new ProviderStandardSearchResultViewModel { TotalResults = 1, PostCodeMissing = false, StandardId = "1", StandardName = "Test name", StandardLevel = 2, Hits = new List <StandardProviderResultItemViewModel>(), HasError = false, NationalProviders = new NationalProviderViewModel { Count = 1 }, ShowAll = true }; var html = detail.RenderAsHtml(model).ToAngleSharp(); GetPartial(html, "p").Should().Contain("There is 1 training option for the Test name, level 2 apprenticeship in England."); }
public void ShouldShowGeneralMessageWhenSeveralResultsAreReturned() { var detail = new StandardSearchResultMessage(); var model = new ProviderStandardSearchResultViewModel { TotalResults = 7, PostCodeMissing = false, StandardId = "1", StandardName = "Test name", StandardLevel = 3, Hits = new List <StandardProviderResultItemViewModel>(), HasError = false, NationalProviders = new NationalProviderViewModel() { Count = 1 } }; var html = detail.RenderAsHtml(model).ToAngleSharp(); GetPartial(html, "p").Should().Contain("There are 7 training options for the Test name, level 3 apprenticeship."); }
public void ShouldShowMessageInformingAboutNationalLabel() { var detail = new StandardSearchResultMessage(); var model = new ProviderStandardSearchResultViewModel { TotalResults = 7, PostCodeMissing = false, StandardId = "1", StandardName = "Test name", StandardLevel = 3, Hits = new List <StandardProviderResultItemViewModel>(), 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 StandardSearchResultMessage(); var model = new ProviderStandardSearchResultViewModel { TotalResults = 0, PostCodeMissing = false, StandardId = "1", StandardName = "Test standard name", Hits = new List <StandardProviderResultItemViewModel>(), ActualPage = 1, LastPage = 1, ResultsToTake = 10, PostCode = "Test postcode", DeliveryModes = new List <DeliveryModeViewModel>(), HasError = false, TotalResultsForCountry = 0 }; var html = detail.RenderAsHtml(model).ToAngleSharp(); GetPartial(html, ".total-providers-country").Should().BeEmpty(); }
public void ShouldNotShowMessageInformingAboutNationalLabel(int totalResults, int nationalProviders) { var detail = new StandardSearchResultMessage(); var model = new ProviderStandardSearchResultViewModel { TotalResults = totalResults, PostCodeMissing = false, StandardId = "1", StandardName = "Test name", StandardLevel = 3, PostCode = "N17", Hits = new List <StandardProviderResultItemViewModel>(), 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(); }