Beispiel #1
0
        public int v2()
        {
            string readerType = (string)this.Param;
            if (AsyncUtil.IsAsyncEnabled)
            {
                if (readerType == "XmlBinaryReader")
                {
                    return TEST_SKIPPED;
                }
            }
            string str = "<abc abc='\uD812\uDD12'>\uD812\uDD12</abc>";
            string exp = "<?xml version=\"1.0\" encoding=\"utf-16\"?><abc abc=\"\U00014912\">\U00014912</abc>";
            exp = (readerType == "XmlBinaryReader") ? "<?xml version=\"1.0\" encoding=\"utf-8\"?><abc abc=\"\U00014912\">\U00014912</abc>" : exp;
            byte[] bytes = Encoding.Unicode.GetBytes(str);
            XmlReaderSettings rs = new XmlReaderSettings();

            OneByteStream sim = new OneByteStream(bytes);
            using (XmlReader r = ReaderHelper.CreateReader(readerType, sim, null, false, null, rs, false))
            {
                using (StringWriter sw = new StringWriter())
                {
                    using (XmlWriter w = WriterHelper.Create(sw))
                    {
                        w.WriteNode(r, false);
                    }
                    CError.Compare(sw.ToString(), exp, "writer output");
                }
            }
            return TEST_PASS;
        }
Beispiel #2
0
        public int v0()
        {
            string readerType = (string)this.Param;
            if (AsyncUtil.IsAsyncEnabled)
            {
                if (readerType == "XmlBinaryReader")
                {
                    return TEST_SKIPPED;
                }
            }
            if (readerType == "SubtreeReader" || readerType == "XmlNodeReader") return TEST_SKIPPED;
            OneByteStream sim = new OneByteStream(new byte[] { 0xFE, 0xFF, 0, (byte)'s', 0, (byte)'o',
            0, (byte)'s', 0, (byte)'o', 0, (byte)'s', 0, (byte)'o', 0, (byte)'s', 0, (byte)'o',
            0, (byte)']'});

            XmlReaderSettings rs = new XmlReaderSettings();
            rs.ConformanceLevel = ConformanceLevel.Fragment;
            using (XmlReader r = ReaderHelper.CreateReader(readerType, sim, null, false, null, rs, true))
            {
                while (r.Read()) { CError.WriteLine(r.Value); }
            }
            return TEST_PASS;
        }
Beispiel #3
0
        public int v1()
        {
            string readerType = (string)this.Param;
            if (AsyncUtil.IsAsyncEnabled)
            {
                if (readerType == "XmlBinaryReader")
                {
                    return TEST_SKIPPED;
                }
            }
            string str = "<abc abc='\uD812\uDD12'>\uD812\uDD12</abc>";
            byte[] bytes = Encoding.Unicode.GetBytes(str);
            XmlReaderSettings rs = new XmlReaderSettings();

            OneByteStream sim = new OneByteStream(bytes);
            using (XmlReader r = ReaderHelper.CreateReader(readerType, sim, null, false, null, rs, false))
            {
                while (r.Read()) { CError.WriteLine(r.Value); }
                return TEST_PASS;
            }
        }
Beispiel #4
0
        public int Read33a()
        {
            OneByteStream sim = new OneByteStream(new byte[] { 0xFE, 0xFF, 0, (byte)'s', 0, (byte)'o',
            0, (byte)'s', 0, (byte)'o', 0, (byte)'s', 0, (byte)'o', 0, (byte)'s', 0, (byte)'o',
            0, (byte)']'});

            XmlReaderSettings set = new XmlReaderSettings();
            set.ConformanceLevel = ConformanceLevel.Fragment;
            using (XmlReader r = ReaderHelper.Create(sim, set))
            {
                r.Read();
                CError.WriteLine(r.Value);
            }
            return TEST_PASS;
        }