public RatingEngine(ILogger logger, IPolicySource policySource, IPolicySerializer policySerializer, RaterFactory raterFactory) { _logger = logger; _policySource = policySource; _policySerializer = policySerializer; _raterFactory = raterFactory; }
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."); }
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."); }
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."); }