public int var_2()
{
if (WriterType != WriterType.UnicodeWriter)
return TEST_SKIPPED;
Encoding enc = Encoding.GetEncoding("UTF-16BE");
Stream s = new MemoryStream();
byte[] preamble = enc.GetPreamble();
s.Write(preamble, 0, preamble.Length);
s.Flush();
using (StreamWriter sw = new StreamWriter(s, enc, 512, true))
{
using (XmlWriter xw = WriterHelper.Create(sw))
{
xw.WriteStartDocument();
xw.WriteElementString("A", "value");
xw.WriteEndDocument();
}
}
if (s.CanSeek)
{
s.Position = 0;
}
StreamReader sr = new StreamReader(s);
string str = sr.ReadToEnd();
CError.WriteLine(str);
return (str.Equals("<?xml version=\"1.0\" encoding=\"utf-16BE\"?><A>value</A>", StringComparison.OrdinalIgnoreCase)) ? TEST_PASS : TEST_FAIL;
}
}