public void TotalPrice_WhenThereAreNoProductsInList_ShouldReturnZero() { // Arrange var shoppingCart = new MockedShoppingCart(); // Act var executionResult = shoppingCart.TotalPrice(); // Assert Assert.AreEqual(0M, executionResult); }
public void TotalPrice_WhenThereAreProductsInList_ShouldReturnTheTotalSumOfTheirPrices() { // Arrange var mockedProductOne = new Mock<IProduct>(); var mockedProductTwo = new Mock<IProduct>(); var shoppingCart = new MockedShoppingCart(); mockedProductOne.SetupGet(x => x.Price).Returns(10M); mockedProductTwo.SetupGet(x => x.Price).Returns(20M); shoppingCart.Products.Add(mockedProductOne.Object); shoppingCart.Products.Add(mockedProductTwo.Object); // Act var executionResult = shoppingCart.TotalPrice(); // Assert Assert.AreEqual(30M, executionResult); }