コード例 #1
0
        public void GetReaderAtContent_ObjectWithXmlObjectSerializer_ReturnsExpected()
        {
            var extensionObject = new ExtensionObject()
            {
                Value = 10
            };
            var content = new XmlSyndicationContent("type", extensionObject, new DataContractSerializer(typeof(ExtensionObject)));

            using (XmlReader reader = content.GetReaderAtContent())
            {
                CompareHelper.AssertEqualLongString(@"<content type=""type"" xmlns=""http://www.w3.org/2005/Atom""><XmlSyndicationContentTests.ExtensionObject xmlns=""http://schemas.datacontract.org/2004/07/System.ServiceModel.Syndication.Tests"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""><Value>10</Value></XmlSyndicationContentTests.ExtensionObject></content>", reader.ReadOuterXml());
            }
        }
コード例 #2
0
        public void GetReaderAtContent_ObjectWithXmlSerializer_ReturnsExpected()
        {
            var extensionObject = new ExtensionObject()
            {
                Value = 10
            };
            var content = new XmlSyndicationContent("type", extensionObject, new XmlSerializer(typeof(ExtensionObject)));

            using (XmlReader reader = content.GetReaderAtContent())
            {
                CompareHelper.AssertEqualLongString(@"<content type=""type"" xmlns=""http://www.w3.org/2005/Atom""><ExtensionObject xmlns="""" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><Value>10</Value></ExtensionObject></content>", reader.ReadOuterXml());
            }
        }
コード例 #3
0
        public void GetReaderAtContent_WithReader_ReturnsExpected()
        {
            var content = new XmlSyndicationContent(
                new XElement("ParentObject",
                             new XElement("ExtensionObject",
                                          new XElement("Value", 10)
                                          )
                             ).CreateReader()
                );
            XmlReader reader = content.GetReaderAtContent();

            CompareHelper.AssertEqualLongString(@"<ParentObject><ExtensionObject><Value>10</Value></ExtensionObject></ParentObject>", reader.ReadOuterXml());
        }