public void Checkout_SavesBillToSalesHistory() { //Arrange var salesHistoryServiceMock = GetSalesHistoryServiceMockWithActions(); var productsBasket = new ProductsBasket(salesHistoryServiceMock.Object, null, GetDataServiceWithNoSetup()); //Act var bill = productsBasket.Checkout(); //Assert salesHistoryServiceMock.Verify(m => m.Add(It.IsAny <Bill>()), Times.Once); bill.Should().NotBeNull(); }
public void Checkout_ContainsAllDiscountsFromProvider() { //Arrange var discountsProviderMock = new Mock <IDiscountRulesService>(); var discountRules = new[] { new Mock <IDiscountRule>().Object, new Mock <IDiscountRule>().Object, new Mock <IDiscountRule>().Object }; discountsProviderMock.Setup(m => m.GetAllDiscountRules()).Returns(discountRules); var productsBasket = new ProductsBasket(GetSalesHistoryServiceWithNoSetup(), discountsProviderMock.Object, GetDataServiceWithNoSetup()); //Act var bill = productsBasket.Checkout(); //Assert bill.DiscountsRules.Should().BeEquivalentTo(discountRules); }