public void Quantity_Less_Or_Equals_Zero() { this.CreateMockProduct(); cartItemOffer = new CartItemOffer(mockProduct.Object); var ex = Assert.Throws <CartItemOfferException>(() => cartItemOffer.Create(0, 1)); Assert.AreEqual(CartItemOfferExceptionMessage.QuantityLessOrEqualsZero, ex.Message); }
public void Create_Success() { this.CreateMockProduct(); cartItemOffer = new CartItemOffer(mockProduct.Object); var result = cartItemOffer.Create(1, 10); Assert.IsTrue(result.Price == 10); Assert.IsTrue(result.Quantity == 1); Assert.IsTrue(result.Product == mockProduct.Object); }
public void Create_Success() { mockProduct = new Mock <IProduct>(MockBehavior.Strict); mockProduct.Setup(p => p.Id).Returns(1); mockProduct.Setup(p => p.Name).Returns("Banana"); mockProduct.Setup(p => p.Price).Returns(30); cartItemOffer = new CartItemOffer(mockProduct.Object); var result = cartItemOffer.Create(1, 10); Assert.IsTrue(result.Price == 10); Assert.IsTrue(result.Quantity == 1); Assert.IsTrue(result.Product == mockProduct); mockProduct.VerifyAll(); }