コード例 #1
0
ファイル: ObjectDumper.cs プロジェクト: ithanshui/Common-2
        public static void WriteXml(object o, int depth, IEnumerable <string> exclusions, XmlWriter log)
        {
            IDumperWriterStrategy strategy = new XmlWriterStrategy(depth, exclusions, log);

            strategy.Write(o);
            log.Flush();
        }
コード例 #2
0
        public void TestXmlWriterConstructor()
        {
            var       builder   = new StringBuilder();
            XmlWriter xmlWriter = XmlWriter.Create(builder);
            var       strategy  = new XmlWriterStrategy(xmlWriter);

            strategy.Write(One);
            xmlWriter.Flush();
            int result = builder.Length;

            Assert.AreEqual(368, result);
        }
コード例 #3
0
        public void TestXmlWriterConstructorWithDepth()
        {
            long result;

            using (var stream = new MemoryStream()) {
                XmlWriter xmlWriter = XmlWriter.Create(stream);
                var       strategy  = new XmlWriterStrategy(1, null, xmlWriter);
                strategy.Write(Two);
                xmlWriter.Flush();
                result = stream.Length;
            }

            Assert.AreEqual(475, result);
        }
コード例 #4
0
        public void TestXmlWriterWithListOfListWithDepth()
        {
            long result;

            using (var stream = new MemoryStream()) {
                XmlWriter xmlWriter = XmlWriter.Create(stream);
                var       strategy  = new XmlWriterStrategy(2, null, xmlWriter);
                strategy.Write(Three);
                xmlWriter.Flush();
                result = stream.Length;
            }

            Assert.AreEqual(632, result);
        }
コード例 #5
0
ファイル: ObjectDumper.cs プロジェクト: ithanshui/Common-2
        public static void WriteXml(object o, int depth, XmlWriter log, params string[] exclusions)
        {
            IDumperWriterStrategy strategy = new XmlWriterStrategy(depth, exclusions, log);

            strategy.Write(o);
        }