Ejemplo n.º 1
0
        public void TestIsAnyTrueDataContractSerializer()
        {
            TestElement element = new TestElement();
            element.Value = "bar";

            StringBuilder stringBuilder = new StringBuilder ();

            DataContractSerializer ser = new DataContractSerializer (typeof (TestElement));

            using (var xw = XmlDictionaryWriter.CreateDictionaryWriter (XmlWriter.Create (new StringWriter (stringBuilder))))
            {
                ser.WriteObject(xw, element);
            }

            string actualXml   = stringBuilder.ToString ();
            string expectedXml = "<?xml version=\"1.0\" encoding=\"utf-16\"?><dummy>bar</dummy>";

            Assert.AreEqual (expectedXml, actualXml, "#1 IsAny=true DataContractSerializer");
        }
Ejemplo n.º 2
0
        public void TestIsAnyTrueDataContractSerializer()
        {
            TestElement element = new TestElement();

            element.Value = "bar";

            StringBuilder stringBuilder = new StringBuilder();

            DataContractSerializer ser = new DataContractSerializer(typeof(TestElement));

            using (var xw = XmlDictionaryWriter.CreateDictionaryWriter(XmlWriter.Create(new StringWriter(stringBuilder))))
            {
                ser.WriteObject(xw, element);
            }

            string actualXml   = stringBuilder.ToString();
            string expectedXml = "<?xml version=\"1.0\" encoding=\"utf-16\"?><dummy>bar</dummy>";

            Assert.AreEqual(expectedXml, actualXml, "#1 IsAny=true DataContractSerializer");
        }