public IViewComponentResult Invoke(int centreId) { var bannerText = centresDataService.GetBannerText(centreId); var model = new CentreContactInfoViewModel(centreId, bannerText); return(View(model)); }
public void Error_should_pass_the_banner_text() { // Given const string bannerText = "Banner text"; A.CallTo(() => centresDataService.GetBannerText(CentreId)).Returns(bannerText); // When var result = controller.Error(); // Then var expectedModel = new ErrorViewModel(bannerText); result.Should().BeViewResult() .ModelAs <ErrorViewModel>().HelpText().Should().Be(expectedModel.HelpText()); }
private string?GetBannerText() { var centreId = User.GetCentreId(); var bannerText = centresDataService.GetBannerText(centreId); return(bannerText); }