public void Less_Than_10() { //arrange IDiscount target = GetObject(); //assert Assert.AreEqual(5, target.ApplyDiscount(5), "Error value 100"); Assert.AreEqual(0, target.ApplyDiscount(0), "Error value 10"); }
public void Above_100() { //arrange IDiscount target = GetObject(); decimal result_200 = 100; decimal result_500 = 250; //act decimal result1 = target.ApplyDiscount(200); decimal result2 = target.ApplyDiscount(500); //assert Assert.AreEqual(result_200, result1, "Error value 100"); Assert.AreEqual(result_500, result2, "Error value 500"); }
public void las_100() { //arrange IDiscount target = GetObject(); decimal result_50 = 45; decimal result_95 = 90; //act decimal result1 = target.ApplyDiscount(200); decimal result2 = target.ApplyDiscount(500); //assert Assert.AreEqual(result_50, result1, "Error value 100"); Assert.AreEqual(result_95, result2, "Error value 500"); }
public void NegativeVal() { //arrange IDiscount target = GetObject(); target.ApplyDiscount(-10); }
public void Between_100_10() { //arrange IDiscount target = GetObject(); decimal result_100 = 95; decimal result_10 = 5; decimal result_50 = 45; //act decimal result1 = target.ApplyDiscount(100); decimal result2 = target.ApplyDiscount(10); decimal result3 = target.ApplyDiscount(50); //assert Assert.AreEqual(result_100, result1, "Error value 100"); Assert.AreEqual(result_10, result2, "Error value 10"); Assert.AreEqual(result_50, result2, "Error value 50"); }
public Decimal CalculatePayPeriodCost(Person person) { Decimal cost; Decimal monthlyCost; if (person is Employee) { cost = _plan.EmployeeCost; } else { cost = _plan.DependentCost; } monthlyCost = cost / _cycle.NumPeriods; if (_discount != null) { return(_discount.ApplyDiscount(person, monthlyCost)); } return(monthlyCost); }
public decimal SumarizeProducts(IEnumerable <CartLine> products) { var total = products.Sum(x => x.Product.Price * x.Quantity); return(discounter.ApplyDiscount(total)); }
public override double GetPrice() { return(discount.ApplyDiscount(base.GetPrice())); }
public decimal TotalSumWithDiscount(decimal sum) { return(discount.ApplyDiscount(sum)); }
public decimal SumOfPrice(IEnumerable <Book> books) { return(books.Sum(x => discount.ApplyDiscount(x.Price))); }
public void ApplyDiscount(IDiscount discount) { discount.ApplyDiscount(this); }
public void ApplyDiscount(IDiscount discount) { GrandTotalPrice = discount.ApplyDiscount(this); _discounts.Add(discount.Name); }
public override decimal GetSumWithDiscount() { return(discount.ApplyDiscount(GetSum())); }