public async void WhenInternalServerError_UnknownTickerSymbolExceptionThrown() { // Arrange var httpClient = FakeHttpClientFactory.CreateFakeHttpClientForStringContent(HttpStatusCode.InternalServerError, "text/plain", "Internal Server Error"); StockQuoteClient client = new StockQuoteClient(httpClient); // Act and Assert var result = await Assert.ThrowsAsync <ApplicationException>(() => client.GetStockQuote("ZVZZT")); }
public async void WhenTickerSymbolNotFound_UnknownTickerSymbolExceptionThrown() { // Arrange var httpClient = FakeHttpClientFactory.CreateFakeHttpClientForStringContent(HttpStatusCode.NotFound, "text/plain", "Symbol not found"); StockQuoteClient client = new StockQuoteClient(httpClient); // Act and Assert var result = await Assert.ThrowsAsync <UnknownTickerSymbolException>(() => client.GetStockQuote("ZVZZT")); Assert.Equal("ZVZZT", result.TickerSymbol); }