Ejemplo n.º 1
0
 public RatingEngine(ILogger logger, IPolicySource policySource, IPolicySerializer policySerializer, RaterFactory raterFactory)
 {
     _logger           = logger;
     _policySource     = policySource;
     _policySerializer = policySerializer;
     _raterFactory     = raterFactory;
 }
Ejemplo n.º 2
0
        public void Rate()
        {
            Logger.Log("Starting rate.");
            Logger.Log("Loading policy.");

            string policyJson = PolicySource.GetPolicyFromSource();
            var    policy     = PolicySerializer.GetPolicyFromJsonString(policyJson);

            var factory = new RaterFactory();
            var rater   = factory.Create(policy, this);

            rater.Rate(policy);
            Logger.Log("Rating completed.");
        }
Ejemplo n.º 3
0
        public void Rate()
        {
            Logger.Log("Starting rate.");
            Logger.Log("Loading policy.");

            string policyJson = FilePolicySource.GetFilePolictyFromSource("policy.json");
            var    policy     = PolicyDeserialilzer.GetDeserializePolicy(policyJson);

            var factory = new RaterFactory();

            var rater = factory.Create(policy, this);

            rater?.Rate(policy);

            Logger.Log("Rating completed.");
        }
Ejemplo n.º 4
0
        public void Rate()
        {
            // Logging - how is delegated
            Logger.Log("Starting rate.");

            Logger.Log("Loading policy.");

            // Persistence - how is delegated
            var policyJson = PolicySource.GetPolicyFromSource();

            // Encoding Format - how is delegated
            var policy = PolicySerializer.GetPolicyFromJsonString(policyJson);

            var factory = new RaterFactory();

            var rater = factory.Create(policy, this);

            rater?.Rate(policy);

            Logger.Log("Rating completed.");
        }