public void CalculateDiscount_TenDollarDiscountOn100DollarReturns10() { var sourceCode = new SourceCode { DiscountType = DiscountType.PerOrder, DiscountValueType = DiscountValueType.Money, CouponValue = 10m }; var returnValue = sourceCode.CalculateDiscount(100m); Assert.AreEqual(10m, returnValue); }
public void CalculateDiscount_Package1TenDollarDiscountGives10DiscountIfPackage2IsSelected() { var packageDiscounts = new List <SourceCodeItemWiseDiscount>(); packageDiscounts.Add(new SourceCodeItemWiseDiscount { Id = 1, DiscountValueType = DiscountValueType.Money, DiscountAmount = 10m }); _sourceCode1.PackageDiscounts = packageDiscounts; var selectedPackageId = 1; var returnValue = _sourceCode1.CalculateDiscount(100m, selectedPackageId); Assert.AreEqual(10m, returnValue); }
public void CalculateDiscount_Package1TenDollarDiscountGivesNoDiscountIfPackage2IsSelected() { var packageDiscounts = new List <SourceCodeItemWiseDiscount>(); packageDiscounts.Add(new SourceCodeItemWiseDiscount { Id = 1, DiscountValueType = DiscountValueType.Money, DiscountAmount = 10m }); var sourceCode = new SourceCode { DiscountType = DiscountType.PerPackage, DiscountValueType = DiscountValueType.Money, CouponValue = 10m }; var selectedPackageId = 2; var returnValue = sourceCode.CalculateDiscount(100m, selectedPackageId); Assert.AreEqual(0m, returnValue); }