public void CannotBuyExpiredOffer() { var offer = OfferFactory.NewOfferValidUntil(DateTime.Now.AddDays(-5)); Exception ex = Throws <ApplicationException>(() => offer.Buy(PolicyHolderFactory.Abc())); Equal($"Offer {offer.Number} has expired", ex.Message); }
public void CannotBuyAlreadyConvertedOffer() { var offer = OfferFactory.AlreadyConvertedOffer(); Exception ex = Throws <ApplicationException>(() => offer.Buy(PolicyHolderFactory.Abc())); Equal($"Offer {offer.Number} is not in new status and connot be bought", ex.Message); }
public void CanBuyNewNonExpiredOffer() { var offer = OfferFactory.NewOfferValidUntil(DateTime.Now.AddDays(5)); var policy = offer.Buy(PolicyHolderFactory.Abc()); Equal(OfferStatus.Converted, offer.Status); Equal(offer.TotalPrice, policy.Version(1).TotalPremiumAmount); }