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()); }