public void GetTrades_IfNotSuccessStatusCode_ThrowException() { mockHttpClient.Setup(s => s.GetAsync(SourcePath)) .ReturnsAsync(new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }); Assert.Throws <ArgumentNullException>(() => sut.GetStockQuotes(SourcePath)); mockHttpClient.Verify(s => s.GetAsync(SourcePath), Times.Exactly(3)); }
public void ReadContents_IfFileDoesNotExists_ThrowException() { mockFileWrapper.Setup(s => s.Exists(sourcePath)).Returns(false); Assert.Throws <InvalidOperationException>(() => sut.GetStockQuotes(sourcePath)); }