public async Task Returns_503_When_IBannerRepository_Throws_Exception() { string id = ""; _bannerRepository.Setup(br => br.GetBannerHtml(id)).Throws(new Exception("DB down")); var response = await _bannerController.GetBannerHtml(id); Assert.IsTrue(response is StatusCodeResult); var statusCode = (StatusCodeResult)response; statusCode.StatusCode.Should().Be((int)HttpStatusCode.ServiceUnavailable); }