public RatingEngineRate()
        {
            _logger           = new FakeLogger();
            _policySource     = new FakePolicySource();
            _policySerializer = new JsonPolicySerializer();

            _engine = new RatingEngine(_logger,
                                       _policySource,
                                       _policySerializer,
                                       new RaterFactory(_logger));
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
        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);
        }