コード例 #1
0
        public void TestSerialize()
        {
            string originalXml, newXml, filename;

            foreach (string file in files)
            {
                DocumentEditor editor = new DocumentEditor();
                DocumentBuffer buffer = (DocumentBuffer)editor.Buffer;

                MonoDocument document = new MonoDocument(file);
                filename    = Path.GetFileName(file);
                originalXml = document.Xml;

                buffer.Undoer.FreezeUndo();
                DocumentBufferArchiver.Deserialize(buffer, originalXml);
                buffer.Undoer.ThrawUndo();
                newXml = DocumentBufferArchiver.Serialize(buffer);

                Assert.AreEqual(originalXml, newXml, "SR:" + filename);
            }
        }
コード例 #2
0
        public void TestSerializePerformance()
        {
            foreach (string file in files)
            {
                DocumentEditor editor = new DocumentEditor();
                DocumentBuffer buffer = (DocumentBuffer)editor.Buffer;

                MonoDocument document = new MonoDocument(file);
                string       filename = Path.GetFileName(file);

                buffer.Undoer.FreezeUndo();
                DocumentBufferArchiver.Deserialize(buffer, document.Xml);
                buffer.Undoer.ThrawUndo();

                DateTime startTime = DateTime.Now;
                DocumentBufferArchiver.Serialize(buffer);
                DateTime stopTime = DateTime.Now;

                TimeSpan duration = stopTime - startTime;
                Assert.Less(duration.TotalMilliseconds, 3000, "SP:" + filename);
            }
        }