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

            Assert.That(deserialized, Is.Not.Null);
            Assert.That(serializer.ParsingErrors, Has.Count.EqualTo(0));
        }
예제 #2
0
        public void AttributeNamespaceSerializationTest()
        {
            const string result = "<AttributeNamespaceSample xmlns:ns=\"http://namespaces.org/ns\" xmlns=\"http://namespaces.org/default\">" + @"
  <Attribs " + "attrib=\"value\" ns:attrib2=\"value2\"" + @" />
</AttributeNamespaceSample>";

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

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