示例#1
0
        public RatingEngineRate()
        {
            _logger           = new FakeLogger();
            _policySource     = new FakePolicySource();
            _policySerializer = new JsonPolicySerializer();

            _engine = new RatingEngine(_logger,
                                       _policySource,
                                       _policySerializer,
                                       new RaterFactory(_logger));
        }
        public void LogsMakeRequiredMessageGivenPolicyWithoutMake()
        {
            var policy = new Policy()
            {
                Type = "Auto"
            };
            var logger = new FakeLogger();
            var rater  = new AutoPolicyRater(null);

            rater.Logger = logger;
            rater.Rate(policy);
            Assert.Equal("Auto policy must specify Make", logger.LoggedMessages.Last());
        }
        public void LogMakeRequiredMessageGivenPolicyWithoutMake()
        {
            var policy = new Policy {
                Type = PolicyType.Auto
            };
            var logger = new FakeLogger();//use Moq instead of dummy implementations
            var rater  = new AutoPolicyRater(null);

            rater.Logger = logger;

            rater.Rate(policy);

            Assert.Equal("Auto policy must specify Make", logger.LoggedMessages.Last());
        }
        public void SetsRatingTo900ForBMWWith500Deductible()
        {
            var policy = new Policy()
            {
                Type       = "Auto",
                Make       = "BMW",
                Deductible = 500m
            };
            var logger = new FakeLogger();
            var rater  = new AutoPolicyRater(logger);

            var result = rater.Rate(policy);

            Assert.Equal(900m, result);
        }
示例#5
0
        public void SetsRatingTo1000ForBMWWith250Deductible()
        {
            var policy = new Policy()
            {
                Type       = "Auto",
                Make       = "BMW",
                Deductible = 250m
            };

            var logger = new FakeLogger();
            var rater  = new AutoPolicyRater(logger);

            rater.Rate(policy);

            Assert.Equal(1000m, );
        }
        public void SetsRatingTo1000ForBMWWith250Deductible()
        {
            //Given
            var policy = new Policy()
            {
                Type       = "Auto",
                Make       = "BMW",
                Deductible = 250m
            };
            var logger = new FakeLogger();
            var rater  = new AutoPolicyRater(logger);

            //When
            var result = rater.Rate(policy);

            //Then
            Assert.Equal(1000m, result);
        }