public void GetMyStocksBadInput() { var stockTicker = new Mock <IStockTicker>(); stockTicker.Setup(st => st.GetStocksByUser(It.IsAny <string>())) .Returns(new List <Stock>() { new Stock() }); var hub = new StockQuoteHub(stockTicker.Object); var result = hub.GetMyStocks(""); stockTicker.VerifyNoOtherCalls(); Assert.IsNull(result); }
public void GetMyStocksSuccess() { var stockTicker = new Mock <IStockTicker>(); stockTicker.Setup(st => st.GetStocksByUser(It.IsAny <string>())) .Returns(new List <Stock>() { new Stock() }); var hub = new StockQuoteHub(stockTicker.Object); var result = hub.GetMyStocks("jon"); stockTicker.VerifyAll(); Assert.AreEqual(1, result.Count); }