Beispiel #1
0
        public void MultiLevelMemberAndClassDifferentNamespacesDeserializationTest()
        {
            var    serializer   = new YAXSerializer(typeof(CellPhone_MultiLevelMemberAndClassDifferentNamespaces), YAXExceptionHandlingPolicies.DoNotThrow, YAXExceptionTypes.Warning, YAXSerializationOptions.SerializeNullObjects);
            string got          = serializer.Serialize(CellPhone_MultiLevelMemberAndClassDifferentNamespaces.GetSampleInstance());
            var    deserialized = serializer.Deserialize(got) as CellPhone_MultiLevelMemberAndClassDifferentNamespaces;

            Assert.That(deserialized, Is.Not.Null);
            Assert.That(serializer.ParsingErrors, Has.Count.EqualTo(0));
        }
Beispiel #2
0
        public void MultiLevelMemberAndClassDifferentNamespacesSerializationTest()
        {
            const string result =
                @"<CellPhone_MultiLevelMemberAndClassDifferentNamespaces xmlns:x1=""http://namespace.org/x1"" xmlns=""http://namespace.org/nsmain"">
  <Level1>
    <Level2>
      <x1:TheName>HTC</x1:TheName>
    </Level2>
  </Level1>
  <OS>Windows Phone 8</OS>
</CellPhone_MultiLevelMemberAndClassDifferentNamespaces>";

            var    serializer = new YAXSerializer(typeof(CellPhone_MultiLevelMemberAndClassDifferentNamespaces), YAXExceptionHandlingPolicies.DoNotThrow, YAXExceptionTypes.Warning, YAXSerializationOptions.SerializeNullObjects);
            string got        = serializer.Serialize(CellPhone_MultiLevelMemberAndClassDifferentNamespaces.GetSampleInstance());

            Assert.That(got, Is.EqualTo(result));
        }