public void AddEquity_PriceIsLessThanZero_ThrowException() { //Arrange var price = -1M; var builderFactory = A.Fake <IBuilderFactory>(); var stockRepository = A.Fake <IStockRepository>(); var fund = new Fund(builderFactory, stockRepository); //Act and Assert Assert.Throws <ArgumentOutOfRangeException>(() => fund.AddEquity(price, 1)); }
public void AddEquity_PositiveTest_Equity() { //Arrange var price = 200M; var quantity = 1M; var builderFactory = A.Fake <IBuilderFactory>(); var stockRepository = A.Fake <IStockRepository>(); var fund = new Fund(builderFactory, stockRepository); //Act fund.AddEquity(price, quantity); //Assert A.CallTo(stockRepository) .Where(call => call.Method.Name == "AddStock") .MustHaveHappened(Repeated.Exactly.Once); }