public void TestProductEqualsIdenticalProduct() { ProductId prodOneId = new ProductId("1"); Product prodOne = new Product(prodOneId, 10m); Product prodOneClone = new Product(prodOneId, 10m); Assert.IsTrue(prodOne.Equals(prodOneClone)); }
public void TestProductDiscountWithNullDiscount() { ProductId prodOneId = new ProductId("1"); Product prodOne = new Product(prodOneId, 10m); decimal discountedPrice = prodOne.DiscountPrice(null); Assert.IsTrue(discountedPrice == 10m); }
public void TestProductNotEqualsDifferentProductById() { ProductId prodOneId = new ProductId("1"); ProductId prodTwoId = new ProductId("2"); Product prodOne = new Product(prodOneId, 10m); Product prodTwo = new Product(prodTwoId, 10m); Assert.IsFalse(prodOne.Equals(prodTwo)); }
public void TestProductDiscountWithValidDiscountByDate() { ProductId prodOneId = new ProductId("1"); Product prodOne = new Product(prodOneId, 10m); DiscountByDate discount = new DiscountByDate(.1m, DateTime.Now.AddDays(1)); decimal discountedPrice = prodOne.DiscountPrice(discount); Assert.IsTrue(discountedPrice == 9m); }
public void TestProductDiscountWithInvalidDiscount() { ProductId prodOneId = new ProductId("1"); Product prodOne = new Product(prodOneId, 10m); string notADiscount = "bad discount"; decimal discountedPrice = prodOne.DiscountPrice(notADiscount); Assert.IsTrue(discountedPrice == 10m); }
public override int GetHashCode() { return(2335 + ProductId.GetHashCode()); }
public Product(ProductId productId, decimal price) { ProductId = productId; Price = price; }
public void TestProductReturnsListPrice() { ProductId prodOneId = new ProductId("1"); decimal ListPrice = 10m; Product prodOne = new Product(prodOneId, ListPrice); Assert.IsTrue(prodOne.ListPrice == ListPrice); }
public void TestProductNotEqualsNull() { ProductId prodOneId = new ProductId("1"); Product prodOne = new Product(prodOneId, 10m); Assert.IsFalse(prodOne.Equals(null)); }
public void TestProductEqualsSameProduct() { ProductId prodOneId = new ProductId("1"); Product prod = new Product(prodOneId, 10m); Assert.IsTrue(prod.Equals(prod)); }