// [Fact] fails in unit-test-land despite succeeding in iis-land public async Task HistoryCsvDoesNotError() { var stockHistory = new StubStockHistoryService(); var dut = new StocksController( null, stockHistory, new YahooStockInformationService(), new StubStockNoteService(), null ); var result = (await dut.HistoryCvs()) as FileStreamResult; Assert.Equal(result.FileDownloadName, "transactionHistory.csv"); }
public async Task HistoryDoesNotError() { var stockHistory = new StubStockHistoryService(); var dut = new StocksController( null, stockHistory, null, null, null ); var result = (await dut.History()) as ViewResult; Assert.Equal(stockHistory.getTransactions(null, null), result.ViewData["transactions"]); }
public async Task IndexDoesNotError() { var dut = new StocksController( null, new StubStockHistoryService(), new YahooStockInformationService(), new StubStockNoteService(), null ); var result = await dut.Index() as ViewResult; Assert.True(result.ViewData.ContainsKey("stocks")); // the specific value is not deterministic, but the value hould exist }
public async Task SearchStocksDoesNotError(string s) { var dut = new StocksController( null, new StubStockHistoryService(), new YahooStockInformationService(), new StubStockNoteService(), null ); var result = await dut.SearchStocks(s) as ViewResult; Assert.Equal(s, result.ViewData["symbol"]); Assert.True(result.ViewData.ContainsKey("ChartData")); Assert.True(result.ViewData.ContainsKey("LowHighData")); }
public void SetNote() { var stockNote = new MockStockNote(); var dut = new StocksController( null, null, null, stockNote, null ); var result = dut.SetNote("WHEE", "sounds legit"); Assert.Equal("WHEE", stockNote.Symbol); Assert.Equal("sounds legit", stockNote.Note); Assert.True(stockNote.wasCalled); }