Esempio n. 1
0
        public void LoadAsync()
        {
            Stream stream = TestOsdStream.GenerateUncompressedFrom(TestEventXml.E001_Error, TestEventXml.E083_CreateSocket, TestEventXml.E140_CloseSocket);
            DumpLoader loader = new DumpLoader();

            AutoResetEvent completed = new AutoResetEvent(false);
            Dump dump = null;
            List<ProgressChangedEventArgs> progressEvents = new List<ProgressChangedEventArgs>();
            loader.LoadProgressChanged += delegate(object sender, ProgressChangedEventArgs e)
                                          {
                                              lock (progressEvents)
                                                  progressEvents.Add(e);
                                          };
            loader.LoadCompleted += delegate(object sender, LoadCompletedEventArgs e)
                                    {
                                        dump = e.Dump;
                                        completed.Set();
                                    };
            loader.LoadAsync(stream, this);

            completed.WaitOne();

            VerifyEvents(dump);
            Assert.That(progressEvents.Count, Is.EqualTo(3));
            Assert.That(progressEvents[0].ProgressPercentage, Is.EqualTo(33));
            Assert.That(progressEvents[1].ProgressPercentage, Is.EqualTo(66));
            Assert.That(progressEvents[2].ProgressPercentage, Is.EqualTo(100));
        }
Esempio n. 2
0
 public void LoadTags()
 {
     Stream stream = TestOsdStream.GenerateUncompressedFrom(TestEventXml.E083_CreateSocket);
     DumpLoader loader = new DumpLoader();
     Dump dump = loader.Load(stream);
     Assert.That(dump.Events[83].Tags.Count, Is.AtLeast(1));
 }
Esempio n. 3
0
        private void LoadAndVerifyEvents(Stream stream)
        {
            DumpLoader loader = new DumpLoader();
            Dump       dump   = loader.Load(stream);

            VerifyEvents(dump);
        }
Esempio n. 4
0
        public void LoadAsync()
        {
            Stream     stream = TestOsdStream.GenerateUncompressedFrom(TestEventXml.E001_Error, TestEventXml.E083_CreateSocket, TestEventXml.E140_CloseSocket);
            DumpLoader loader = new DumpLoader();

            AutoResetEvent completed = new AutoResetEvent(false);
            Dump           dump      = null;
            List <ProgressChangedEventArgs> progressEvents = new List <ProgressChangedEventArgs>();

            loader.LoadProgressChanged += delegate(object sender, ProgressChangedEventArgs e)
            {
                lock (progressEvents)
                    progressEvents.Add(e);
            };
            loader.LoadCompleted += delegate(object sender, LoadCompletedEventArgs e)
            {
                dump = e.Dump;
                completed.Set();
            };
            loader.LoadAsync(stream, this);

            completed.WaitOne();

            VerifyEvents(dump);
            Assert.That(progressEvents.Count, Is.EqualTo(3));
            Assert.That(progressEvents[0].ProgressPercentage, Is.EqualTo(33));
            Assert.That(progressEvents[1].ProgressPercentage, Is.EqualTo(66));
            Assert.That(progressEvents[2].ProgressPercentage, Is.EqualTo(100));
        }
Esempio n. 5
0
        public void LoadTags()
        {
            Stream     stream = TestOsdStream.GenerateUncompressedFrom(TestEventXml.E083_CreateSocket);
            DumpLoader loader = new DumpLoader();
            Dump       dump   = loader.Load(stream);

            Assert.That(dump.Events[83].Tags.Count, Is.AtLeast(1));
        }
Esempio n. 6
0
        private void SaveAndLoadFullCycle(DumpFormat dumpFormat)
        {
            DumpSaver    saver         = new DumpSaver();
            MemoryStream outStream     = new MemoryStream();
            Dump         canonicalDump = GenerateTestDump();

            saver.Save(canonicalDump, dumpFormat, outStream);

            DumpLoader loader     = new DumpLoader();
            Dump       loadedDump = loader.Load(new MemoryStream(outStream.ToArray()));

            foreach (KeyValuePair <uint, Event> entry in loadedDump.Events)
            {
                Assert.That(entry.Value.RawData, Is.EqualTo(canonicalDump.Events[entry.Key].RawData));
            }
        }
Esempio n. 7
0
 private void LoadAndVerifyEvents(Stream stream)
 {
     DumpLoader loader = new DumpLoader();
     Dump dump = loader.Load(stream);
     VerifyEvents(dump);
 }
Esempio n. 8
0
        private void SaveAndLoadFullCycle(DumpFormat dumpFormat)
        {
            DumpSaver saver = new DumpSaver();
            MemoryStream outStream = new MemoryStream();
            Dump canonicalDump = GenerateTestDump();
            saver.Save(canonicalDump, dumpFormat, outStream);

            DumpLoader loader = new DumpLoader();
            Dump loadedDump = loader.Load(new MemoryStream(outStream.ToArray()));
            foreach (KeyValuePair<uint, Event> entry in loadedDump.Events)
            {
                Assert.That(entry.Value.RawData, Is.EqualTo(canonicalDump.Events[entry.Key].RawData));
            }
        }