Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }