Esempio n. 1
0
        public void TryWriteXmlOfIdentifierWithoutValue_ThrowException()
        {
            IilIdentifier actual_src = new IilIdentifier();

            XmlSerializer serializer = new XmlSerializer(typeof (IilIdentifier));

            Assert.Catch<Exception>(() => serializer.Serialize(GenerateWriter(), actual_src));
        }
        public void TryReadXmlOfIdentifierWithValue_EisIdentifierObject()
        {
            IilIdentifier expected = new IilIdentifier("test_id");

            XmlSerializer serializer = new XmlSerializer(typeof (IilIdentifier));

            XElement actual_src = XElement.Parse(@"<identifier value=""test_id"" />");

            IilIdentifier actual = (IilIdentifier) serializer.Deserialize(actual_src.CreateReader());
            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        public void WriteXmlOfIdentifierWithValue_XmlRepresentationOfIdentifierWithValue()
        {
            IilIdentifier actual_src = new IilIdentifier("test_id");
            StringBuilder sb = new StringBuilder();

            XmlSerializer serializer = new XmlSerializer(typeof (IilIdentifier));
            serializer.Serialize(XmlWriter.Create(sb), actual_src);

            XDocument expected = XDocument.Parse(
                @"<?xml version=""1.0"" encoding=""utf-16""?>
                <identifier value=""test_id"" />");

            XDocument actual = XDocument.Parse(sb.ToString());

            Assert.AreEqual(expected.ToString(), actual.ToString());
        }