Beispiel #1
0
        public void TestExecuteServiceMethod()
        {
            var call = new CallObject
            {
                SessionKey = "BJdRMaB+4lZMa8ClLdCGrejStSRXZ2kEacSTppLvwHLWpmBCFmtyX5ViO6DJBRgO"
            };

            call.SetValue("POLICY_ID", "2000000");
            call.SetValue("XPM_USER", "*****@*****.**");
            call.SetValue("USER_NAME", "ESUWEBUSER");
            string results = GeneralUtility.ExecuteMethod("EsuranceServices.ClaimService.ClaimService.GetPolicyXml", call.ToXml());

            Console.WriteLine(results);
        }
Beispiel #2
0
        public void TestNodeCount()
        {
            var call = new CallObject {
                CallId = "12"
            };

            Assert.IsNotEmpty(call.GetValue("CALL_ID"));

            call.SetValue("CLAIM:VEHICLE[0]:VIN", "123456789");
            call.SetValue("CLAIM:VEHICLE[1]:VIN", "123456789");
            call.SetValue("CLAIM:VEHICLE[2]:VIN", "123456789");
            call.SetValue("CLAIM:VEHICLE[3]:VIN", "123456789");

            Assert.IsTrue(call.GetNodeCount("CLAIM:VEHICLE") == 4);
        }
Beispiel #3
0
        /// <summary>
        /// Processes the node.
        /// </summary>
        /// <param name="element">The element.</param>
        private void ProcessNode(Composite element)
        {
            var pattern = new Regex(_expression);

            foreach (CompositeBase c in element)
            {
                if (!c.IsLeaf || !pattern.IsMatch(c.Name))
                {
                    continue;
                }
                if (string.IsNullOrEmpty(_name))
                {
                    _oCall.SetValue(c.Name, c.Value);
                }
                else
                {
                    _oCall.SetValue(string.Format("{0}:{1}", _name, c.Name), c.Value);
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Processes the node.
        /// </summary>
        /// <param name="element">The element.</param>
        private void ProcessNode(Composite element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            var address = String.Empty;
            var city    = String.Empty;
            var state   = String.Empty;
            var zipCode = String.Empty;

            foreach (var oLeaf in (from CompositeBase c in element where c.IsLeaf select c).Cast <CompositeLeaf>())
            {
                if (oLeaf.Name.IndexOf(Address.AddressLine1, StringComparison.Ordinal) > -1)
                {
                    address = oLeaf.Value;
                }
                else if (oLeaf.Name.IndexOf(Address.AddressCity, StringComparison.Ordinal) > -1)
                {
                    city = oLeaf.Value;
                }
                else if (oLeaf.Name.IndexOf(Address.AddressState, StringComparison.Ordinal) > -1)
                {
                    state = oLeaf.Value;
                }
                else if (oLeaf.Name.IndexOf(Address.AddressZip, StringComparison.Ordinal) > -1)
                {
                    zipCode = oLeaf.Value;
                }
            }
            if (address == String.Empty || city == String.Empty || state == String.Empty || zipCode == String.Empty)
            {
                return;
            }
            _call.SetValue("ADDRESS[" + _curentIndex + "]:NAME", _name);
            _call.SetValue("ADDRESS[" + _curentIndex + "]:ADDRESS_LINE1", address);
            _call.SetValue("ADDRESS[" + _curentIndex + "]:ADDRESS_CITY", city);
            _call.SetValue("ADDRESS[" + _curentIndex + "]:ADDRESS_STATE", state);
            _call.SetValue("ADDRESS[" + _curentIndex + "]:ADDRESS_ZIP", zipCode);
            ++_curentIndex;
        }
Beispiel #5
0
        public void TestJson()
        {
            _base.SetValue("CLAIM:VEHICLE[0]:MAKE", "PLYMOUTH");
            _base.SetValue("CLAIM:VEHICLE[0]:MODEL", "VALIANT");
            _base.SetValue("CLAIM:VEHICLE[1]:MAKE", "DODGE");
            _base.SetValue("CLAIM:VEHICLE[1]:MODEL", "RAM");
            _base.SetValue("CLAIM:VEHICLE[2]:MAKE", "TOYOTA");
            _base.SetValue("CLAIM:VEHICLE[2]:MODEL", "CAMRY");
            _base.Instance      = "TEST";
            _base.CallStartTime = "12:00 PM";
            _base.CallStartDate = "12/12/2008";
            string script = _base.ToJson();

            Console.WriteLine(script);

            var test = new CallObject();

            test.LoadFromJson(script);
            Assert.IsTrue(test.Name == "CALL", "Not working: " + test.Name);

            Assert.IsTrue(test.Instance == "TEST", "Unexpected result INSTANCE!");
            Assert.IsTrue(test.CallStartTime == "12:00 PM", "Unexpected result CALL_START_TIME!");
            Assert.IsTrue(test.CallStartDate == "12/12/2008", "Unexpected result CALL_START_DATE!");
            Assert.IsTrue(test.GetValue("CLAIM:VEHICLE[0]:MODEL") == "VALIANT", "Unexpected result CLAIM:VEHICLE[0]:MODEL!");
            Assert.IsTrue(test.GetValue("CLAIM:VEHICLE[1]:MAKE") == "DODGE", "Unexpected result CLAIM:VEHICLE[1]:MAKE!");
            Assert.IsTrue(test.GetValue("CLAIM:INSURED:VEHICLE:MODEL") == "MATRIX", "Unexpected result CLAIM:INSURED:VEHICLE:MODEL!");
            Assert.IsTrue(test.GetValue("CLAIM:VEHICLE[2]:MODEL") == "CAMRY", "Unexpected result CLAIM:VEHICLE[2]:MODEL!");

            Console.WriteLine(test.ToXml());

            var callObject = Composite.CreateFromJson(script) as CallObject;

            Assert.IsNotNull(callObject, "callObject was null!");
            Assert.IsTrue(callObject.GetType() == typeof(CallObject), "type mismatch");

            Console.WriteLine(callObject.Claim.GetType().ToString());
        }