public void TestSedgwickRuleProcessor() { const string asiDisabilityAttribute = "ASI:CTA_EMPLOYEE_BEGIN_DISABILITY_DT"; using (var call = new CallWrapper()) { call.LoadFromDSN("7679", GeneralUtility.GetDsnFromInstance(DbBaseClass.SEDBA)); var myCall = new CallObject(); myCall.LoadFromXml(call.GetXML()); var originalDate = myCall.GetValue(asiDisabilityAttribute); //NUnit.Framework.Assert.IsTrue(originalDate.Length == 8, "Bad date format!"); var records = RuleRecordSet.GetRuleSetByClientAndEvent("18", "CLOSE", "SEDBA"); NUnit.Framework.Assert.IsTrue(records.Count >= 1, "Problems!"); foreach (var record in records) { var results = Eval.EvaluateCallObject(myCall.ToXml(), record.RuleText); NUnit.Framework.Assert.IsNotEmpty(results, "Nothing returned!"); var resultCall = new CallObject(); resultCall.LoadFromXml(results); NUnit.Framework.Assert.IsNotEmpty(resultCall.GetValue(asiDisabilityAttribute), "Expected result was not returned!"); NUnit.Framework.Assert.IsFalse(originalDate.Equals((resultCall.GetValue(asiDisabilityAttribute))), "dates are unchanged!"); Console.WriteLine("Original: {0} Transformed: {1}", originalDate, resultCall.GetValue(asiDisabilityAttribute)); } } }
public void TestStaticEvalwithCallObject() { var code = new StringBuilder(); code.AppendLine("if (_call.LineOfBusiness.Equals(\"PAU\")) {"); code.AppendLine("\t\t_call.Claim.ClaimNumber = \"123456789\"; }"); code.AppendLine("else {"); code.AppendLine("\t\t_call.Claim.SetValue(\"ERRORSTRING\",\"LOB_CD NOT PAU\"); }"); var results = Eval.EvaluateCallObject(_call.ToXml(), code.ToString()); NUnit.Framework.Assert.IsNotEmpty(results, "Nothing returned!"); Console.WriteLine(results); }