public void Explicit_DataMember_attribute_serializers_private_properties_and_fields() { var person = new ModelWithDataMemberField("field", "property"); Assert.That(person.ToJsv().FromJsv <ModelWithDataMemberField>().GetPrivateField(), Is.EqualTo("field")); Assert.That(person.ToJson().FromJson <ModelWithDataMemberField>().GetPrivateField(), Is.EqualTo("field")); Assert.That(person.ToJsv().FromJsv <ModelWithDataMemberField>().GetPrivateProperty(), Is.EqualTo("property")); Assert.That(person.ToJson().FromJson <ModelWithDataMemberField>().GetPrivateProperty(), Is.EqualTo("property")); }
public void Explicit_DataMember_attribute_also_applies_to_public_fields() { var person = new ModelWithDataMemberField { Id = 1, Name = "A" }; Assert.That(person.ToJsv().FromJsv <ModelWithDataMemberField>().Id, Is.EqualTo(1)); Assert.That(person.ToJson().FromJson <ModelWithDataMemberField>().Id, Is.EqualTo(1)); }
public void Explicit_DataMember_attribute_serializers_private_properties_and_fields() { var person = new ModelWithDataMemberField("field", "property"); Assert.That(person.ToJsv().FromJsv<ModelWithDataMemberField>().GetPrivateField(), Is.EqualTo("field")); Assert.That(person.ToJson().FromJson<ModelWithDataMemberField>().GetPrivateField(), Is.EqualTo("field")); Assert.That(person.ToJsv().FromJsv<ModelWithDataMemberField>().GetPrivateProperty(), Is.EqualTo("property")); Assert.That(person.ToJson().FromJson<ModelWithDataMemberField>().GetPrivateProperty(), Is.EqualTo("property")); }
public void Explicit_DataMember_attribute_also_applies_to_public_fields() { var person = new ModelWithDataMemberField { Id = 1, Name = "A" }; Assert.That(person.ToJsv().FromJsv<ModelWithDataMemberField>().Id, Is.EqualTo(1)); Assert.That(person.ToJson().FromJson<ModelWithDataMemberField>().Id, Is.EqualTo(1)); }