Exemple #1
0
        public void SingleNamespaceDeserializationTest()
        {
            var    serializer   = new YAXSerializer(typeof(SingleNamespaceSample), YAXExceptionHandlingPolicies.DoNotThrow, YAXExceptionTypes.Warning, YAXSerializationOptions.SerializeNullObjects);
            string serialized   = serializer.Serialize(SingleNamespaceSample.GetInstance());
            var    deserialized = serializer.Deserialize(serialized) as SingleNamespaceSample;

            Assert.That(deserialized, Is.Not.Null);
            Assert.That(serializer.ParsingErrors, Has.Count.EqualTo(0));
        }
Exemple #2
0
        public void SingleNamespaceSerializationTest()
        {
            const string result = @"<!-- This example shows usage of a custom default namespace -->
" + "<SingleNamespaceSample xmlns=\"http://namespaces.org/default\">" + @"
  <StringItem>This is a test string</StringItem>
  <IntItem>10</IntItem>
</SingleNamespaceSample>";

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

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