예제 #1
0
        private void ReadAndVerifyBody(Stream stream, DumpFormat dumpFormat)
        {
            XmlDocument doc = new XmlDocument();

            if (dumpFormat == DumpFormat.Compressed)
            {
                stream = new ICSharpCode.SharpZipLib.BZip2.BZip2InputStream(stream);
            }
            doc.Load(stream);
            Assert.That(doc.DocumentElement.ChildNodes.Count, Is.EqualTo(3));
            Assert.That(doc.DocumentElement.ChildNodes.Item(0).OuterXml,
                        Is.EqualTo(XmlString.Canonicalize(TestEventXml.E001_Error)));
            Assert.That(doc.DocumentElement.ChildNodes.Item(1).OuterXml,
                        Is.EqualTo(XmlString.Canonicalize(TestEventXml.E083_CreateSocket)));
            Assert.That(doc.DocumentElement.ChildNodes.Item(2).OuterXml,
                        Is.EqualTo(XmlString.Canonicalize(TestEventXml.E084_Connect)));
        }
예제 #2
0
        public void FromXml()
        {
            Event ev = EventFactory.CreateFromXml(TestEventXml.E001_Error);

            Assert.That(ev, Is.Not.Null & Is.TypeOf(typeof(Event)));

            Assert.That(ev.Id, Is.EqualTo(1));
            Assert.That(ev.Type, Is.EqualTo(EventType.Error));
            Assert.That(ev.ProcessId, Is.EqualTo(2684));
            Assert.That(ev.ProcessName, Is.EqualTo("msnmsgr.exe"));
            Assert.That(ev.ThreadId, Is.EqualTo(1128));
            Assert.That(ev.Timestamp, Is.EqualTo(DateTime.FromFileTimeUtc(128837553502326832)));

            string expectedBody = XmlString.Canonicalize(TestEventXml.E001_Error);
            string actualBody   = ev.RawData;

            Assert.That(actualBody, Is.EqualTo(expectedBody));
        }