public void AddToCartTest() { var product = new ProductBuilder().Constructer(ProductName, Desc, Quantity, Price); var cart = new CartBuilder().Constructer(CartName); cart = cart.AddToCart(product.Id, 1); Assert.Single(cart.Build().CartItems); Assert.IsType <CartItem>(cart.Build().CartItems.FirstOrDefault()); }
public void RaiseCartCreatedEvent() { var item = new CartBuilder().Constructer(CartName); item.Build().CreatedEvent(); Assert.Single(item.Build().Events); Assert.IsType <CartCreated>(item.Build().Events.First()); }
public void RemoveCartItemFalseTest() { var product = new ProductBuilder().Constructer(ProductName, Desc, Quantity, Price); var cart = new CartBuilder().Constructer(CartName); cart = cart.AddToCart(product.Id, 1); CartItem item = cart.Build().CartItems.FirstOrDefault(); Assert.Single(cart.Build().CartItems); Assert.True(cart.RemoveCartItem(new Guid())); Assert.Single(cart.Build().CartItems); }
public void AccumulateCartItemQuantityTest() { var product = new ProductBuilder().Constructer(ProductName, Desc, Quantity, Price); var cart = new CartBuilder().Constructer(CartName); cart = cart.AddToCart(product.Id, 1); CartItem item = cart.Build().CartItems.FirstOrDefault(); cart = cart.AccumulateCartItemQuantity(item.Id, 2); Assert.Single(cart.Build().CartItems); Assert.Equal(3, cart.Build().CartItems.FirstOrDefault().Quantity); }
public void ConstructerTest() { var item = new CartBuilder().Constructer(CartName); Assert.True(item.Build().CartName == CartName); }