public async void PostFinVizItem_ShouldCreateItem() { await using var context = new FinVizContext(ContextOptions); var controller = new FinVizItemsController(context); var stockScreener = new StockScreenerApi.Logic.StockScreener("MSFT"); var expectedObject = stockScreener.ScrapeWeb(); var item = await controller.PostFinVizItem(expectedObject); Assert.Equal("Microsoft.AspNetCore.Mvc.CreatedAtActionResult", item.Result.ToString()); }
public async void GetFinVizItem_ShouldReturnSelectedItem() { await using var context = new FinVizContext(ContextOptions); var controller = new FinVizItemsController(context); var item = await controller.GetFinVizItem("TSLA"); var properties = UnitTestHelper.GetFinVizProperties("TSLA"); var stockScreener = new StockScreenerApi.Logic.StockScreener("TSLA"); var expectedObject = stockScreener.ScrapeWeb(); Assert.All(properties, (prop) => Assert.Equal(prop.GetValue(expectedObject), prop.GetValue(item.Value))); }