public void WriteXmlWithKnownTypePropertyTest() { var value = new ClassWithKnownTypeProperty { Name = "test", Foo = new FooBar { Id = 1, Name = "foobar" } }; var actual = GetConverter().ToXml(value); var expected = @"<xml><name>test</name><fooBar><id>1</id><name>foobar</name></fooBar></xml>"; Assert.That(actual, IsXml.Equals(expected)); }
public void ReadXmlWithKnownTypePropertyTest() { var xml = @"<xml><name>test</name><fooBar><id>1</id><name>foobar</name></fooBar></xml>"; var expected = new ClassWithKnownTypeProperty { Name = "test", Foo = new FooBar { Id = 1, Name = "foobar" } }; var actual = GetConverter().ParseXml <ClassWithKnownTypeProperty>(xml); Assert.AreEqual(expected, actual); }