public static void SetPromotionActive(Product p) { p.IsPromotionActive = IsPromotionActive( p.Price, p.PreviousPrice, p.PriceLastChanged, p.PricePreviouslyLastChanged, Time.Now); }
public void Hadtobestableforatleast30days_Wait29Days() { var product = new Product(); product.Price = 100; Time.AdvanceDays(29); product.Price = 70; _SetPromotionAndAssertOn(product, false); }
public void Aredpencilpromotionlasts30daysasthemaximumlength_31Later() { var product = new Product(); product.Price = 100; Time.AdvanceDays(30); product.Price = 70; _SetPromotionAndAssertOn(product, true); Time.AdvanceDays(31); _SetPromotionAndAssertOn(product, false); }
public void PriceReducedBy04Percent_PromotionNOTActive() { var product = new Product(); product.Price = 100; Time.AdvanceDays(30); product.Price = 96; _SetPromotionAndAssertOn(product, false); }
private static void _SetPromotionAndAssertOn(Product product, bool shouldPromotionBeActive) { PromotionCalculator.SetPromotionActive(product); if (shouldPromotionBeActive) { Assert.True(product.IsPromotionActive); } else { Assert.False(product.IsPromotionActive); } }
public void PriceReducedBy30Percent_PromotionActive() { var product = new Product(); product.Price = 100; Time.AdvanceDays(30); product.Price = 70; _SetPromotionAndAssertOn(product, true); }