コード例 #1
0
        public void AttributeWithDefaultNamespaceDeserializationTest()
        {
            var    serializer   = new YAXSerializer(typeof(AttributeWithNamespace), YAXExceptionHandlingPolicies.DoNotThrow, YAXExceptionTypes.Warning, YAXSerializationOptions.SerializeNullObjects);
            string got          = serializer.Serialize(AttributeWithNamespace.GetSampleInstance());
            var    deserialized = serializer.Deserialize(got) as AttributeWithNamespace;

            Assert.That(deserialized, Is.Not.Null);
            Assert.That(serializer.ParsingErrors, Has.Count.EqualTo(0));
        }
コード例 #2
0
        public void AttributeWithDefaultNamespaceSerializationTest()
        {
            const string result =
                @"<w:font w:name=""Arial"" xmlns:w=""http://example.com/namespace"" />";

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

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