public void ToStringForTimeBasedOfferTest() { const decimal offerPrice = 100m; var today = new DateTime(2017, 2, 10); var start = today.AddDays(-1); var end = today.AddDays(1); using (ShimsContext.Create()) { System.Fakes.ShimDateTime.NowGet = () => { return(today); }; var offer = new TimeSensitiveOffer(offerPrice, start, end); Assert.NotNull(offer); Assert.AreEqual(string.Format("£{0:0.00} from {1:dd MMM yyyy} to {2:dd MMM yyyy}", offerPrice, start, end), offer.ToString()); } }
public void OfferPriceForTimeBasedOfferTest() { const int qty = 1; const decimal individualPrice = 130m; const decimal offerPrice = 100m; var today = new DateTime(2017, 2, 10); var start = today.AddDays(-1); var end = today.AddDays(1); using (ShimsContext.Create()) { System.Fakes.ShimDateTime.NowGet = () => { return(today); }; var offer = new TimeSensitiveOffer(offerPrice, start, end); var price = offer.OfferPrice(qty, individualPrice); Assert.NotNull(offer); Assert.That(offerPrice, Is.EqualTo(price)); } }