public void RemoveStock_StockNameIsNullOrWhiteSpace_ThrowException() { //Arrange var stockName = string.Empty; var builderFactory = A.Fake <IBuilderFactory>(); var stockRepository = A.Fake <IStockRepository>(); var fund = new Fund(builderFactory, stockRepository); //Act and Assert Assert.Throws <ArgumentNullException>(() => fund.RemoveStock(stockName)); }
public void RemoveStock_PositiveTest_StockRemoved() { //Arrange var stockName = "Bond1"; var builderFactory = A.Fake <IBuilderFactory>(); var stockRepository = A.Fake <IStockRepository>(); var fund = new Fund(builderFactory, stockRepository); //Act fund.RemoveStock(stockName); //Assert A.CallTo(stockRepository) .Where(call => call.Method.Name == "RemoveStock") .MustHaveHappened(Repeated.Exactly.Once); }