public void Test_DataContract() { var contract1 = new TestContract1(); SerializeHelper(contract1, contract1.Jsml); DeserializeHelper(contract1, contract1.Jsml); DeserializeHelper(contract1, contract1.LegacyJsml); contract1.Foo = "Macro.Healthcare.ExternalPractitioner, Macro.Healthcare:G:0fa8fdae-4678-40d7-bc54-9ca700e646d9:2"; SerializeHelper(contract1, contract1.Jsml); DeserializeHelper(contract1, contract1.Jsml); DeserializeHelper(contract1, contract1.LegacyJsml); var contract2 = new TestContract2(); SerializeHelper(contract2, contract2.Jsml); DeserializeHelper(contract2, contract2.Jsml); DeserializeHelper(contract2, contract2.LegacyJsml); var now = DateTime.Now; contract2.Double = 5.0; contract2.Bool = true; contract2.NullableDateTime = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); contract2.ExtendedProperties = new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" } }; SerializeHelper(contract2, contract2.Jsml); DeserializeHelper(contract2, contract2.Jsml); DeserializeHelper(contract2, contract2.LegacyJsml); }
public void Test_SerializeOptions() { var now = DateTime.Now; var options = new JsmlSerializer.SerializeOptions { DataMemberTest = (m => AttributeUtils.HasAttribute <DataMemberAttribute>(m) && m.Name != "Double") }; var contract2 = new TestContract2 { Double = 5.0, Bool = true, NullableDateTime = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second), ExtendedProperties = new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" } } }; var jsmlWithoutDouble = contract2.GetJsml(true); SerializeHelper(contract2, jsmlWithoutDouble, options); }