public void Sell_Stock_If_Invalid_Stock_Throws_An_Error() { ArgumentException ex = Assert.Throws <ArgumentException>(() => { _stockMarketService.SellStock("FantasticBeer", 0.75, 2); }); Assert.Equal("FantasticBeer is not a tradable stock.", ex.Message); }
public void Sell_Stock_Add_Trade() { //Arrange var mockRepository = new Mock <ITrade>(); mockRepository.Setup(x => x.AddTrade(It.IsAny <Trade>())); var tradeService = new StockMarketService(mockRepository.Object, DataToTest.Stocks()); //Act tradeService.SellStock(DataToTest.Tea.Symbol, 0.75, 2); //Assert mockRepository.Verify(x => x.AddTrade(It.IsAny <Trade>())); }