public void FreshCheesePriceShouldExpire() { Utils.ReceivedDate = new DateTime(2021, 02, 15); var currentDate = Utils.ReceivedDate; Cheese cheese = new Fresh("Queso Fresco", "2021-02-14", "2", 2.21, CheeseType.Name.Fresh, Utils.ReceivedDate); for (int i = 0; i <= 3; i++) { cheese.SetPrice(cheese, currentDate); currentDate = currentDate.AddDays(1); } Assert.True(cheese.IsExpired(currentDate)); }
public void CheesePriceShouldNotBeLessThan0() { Utils.ReceivedDate = new DateTime(2021, 02, 15); var currentDate = Utils.ReceivedDate; Cheese cheese = new Fresh("Queso Fresco", "2021-02-14", "10", 1.10, CheeseType.Name.Fresh, Utils.ReceivedDate); for (int i = 0; i <= 14; i++) { cheese.SetPrice(cheese, currentDate); currentDate = currentDate.AddDays(1); } Assert.Equal(0, PriceFormatter.ShowPriceAsDecimal(cheese.Price)); }
public void FreshCheesePriceShouldDecreaseAtTwiceTheRateOfStandarCheese() { Utils.ReceivedDate = new DateTime(2021, 02, 15); var currentDate = Utils.ReceivedDate; Cheese cheese = new Fresh("Queso Fresco", "2021-02-14", "4", 2.21, CheeseType.Name.Fresh, Utils.ReceivedDate); for (int i = 0; i < 2; i++) { cheese.SetPrice(cheese, currentDate); currentDate = currentDate.AddDays(1); } Assert.Equal(1.41, PriceFormatter.ShowPriceAsDecimal(cheese.Price)); }