public void CorrectlySerializesObjectsImplementingICustomXmlSerializable_Nested() { var serviceLocator = ServiceLocator.Default; var serializer = serviceLocator.ResolveType <IXmlSerializer>(); var model = new CustomXmlSerializationModelWithNesting { Name = "Test model with nesting", NestedModel = new CustomXmlSerializationModel { FirstName = "Geert" } }; var clonedModel = SerializationTestHelper.SerializeAndDeserialize(model, serializer, null); Assert.IsNotNull(clonedModel.NestedModel); // Note: yes, the *model* is serialized, the *clonedModel* is deserialized Assert.IsTrue(model.NestedModel.IsCustomSerialized); Assert.IsTrue(clonedModel.NestedModel.IsCustomDeserialized); Assert.AreEqual(model.Name, clonedModel.Name); Assert.AreEqual(model.NestedModel.FirstName, clonedModel.NestedModel.FirstName); }
public void CorrectlySerializesObjectsImplementingICustomXmlSerializable_Nested() { var serviceLocator = ServiceLocator.Default; var serializer = serviceLocator.ResolveType<IXmlSerializer>(); var model = new CustomXmlSerializationModelWithNesting { Name = "Test model with nesting", NestedModel = new CustomXmlSerializationModel { FirstName = "Geert" } }; var clonedModel = SerializationTestHelper.SerializeAndDeserialize(model, serializer, null); Assert.IsNotNull(clonedModel.NestedModel); // Note: yes, the *model* is serialized, the *clonedModel* is deserialized Assert.IsTrue(model.NestedModel.IsCustomSerialized); Assert.IsTrue(clonedModel.NestedModel.IsCustomDeserialized); Assert.AreEqual(model.Name, clonedModel.Name); Assert.AreEqual(model.NestedModel.FirstName, clonedModel.NestedModel.FirstName); }