예제 #1
0
        public void Calculate_Premium_Test_RealAge()
        {
            decimal premium     = 600;
            var     memberModel = new MemberModel()
            {
                RatingFactor    = 1m,
                Age             = 50,
                DeathSumInsured = 1000
            };
            PremiumService domainService = new PremiumService();


            var result = domainService.CalculatePremium(memberModel);

            Assert.Equal(premium, result.Premium);
        }
예제 #2
0
        public void Calculate_Premium_Test3()
        {
            decimal premium     = 840;
            var     memberModel = new MemberModel()
            {
                Name            = "Test",
                OccupationId    = 2,
                RatingFactor    = 1m,
                Age             = 7,
                DeathSumInsured = 10000
            };
            PremiumService domainService = new PremiumService();


            var result = domainService.CalculatePremium(memberModel);

            Assert.Equal(premium, result.Premium);
        }
예제 #3
0
        public void CalculatePremiumTest()
        {
            var repoResponse = new Occupation();

            repoResponse.Rating = new Rating {
                Factor = 1.75m, RatingName = "Heavy Manual"
            };

            var serviceRequest = fixture.Build <PremiumRequestView>()
                                 .With(pq => pq.DateOfBirth, DateTime.Now.AddYears(-75))
                                 .With(pq => pq.OccupationId, 4)
                                 .With(pq => pq.SumInsured, 1000000)
                                 .Create();

            occupationRepository.Setup(o => o.GetOccupationById(It.Is <int>(o => o == 4))).Returns(repoResponse);


            var response = premiumService.CalculatePremium(serviceRequest);

            Assert.IsNotNull(response);
            Assert.AreEqual(response.DeathPremium, 1575000.00M);
            Assert.AreEqual(response.RatingDesc, "Heavy Manual");
        }