Пример #1
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));
            }
        }
Пример #2
0
        private void SaveAndVerifyOutput(DumpFormat dumpFormat)
        {
            DumpSaver saver = new DumpSaver();
            MemoryStream outstream = new MemoryStream();
            Dump dump = GenerateTestDump();
            saver.Save(dump, dumpFormat, outstream);
            byte[] buffer = outstream.ToArray();

            Stream stream = new MemoryStream(buffer);
            BinaryReader reader = new BinaryReader(stream);

            ReadAndVerifyHeader(reader, dumpFormat);
            ReadAndVerifyBody(stream, dumpFormat);

            Assert.That(stream.Position, Is.EqualTo(stream.Length),
                         "Should not be any trailing data");
        }
Пример #3
0
        private void SaveAndVerifyOutput(DumpFormat dumpFormat)
        {
            DumpSaver    saver     = new DumpSaver();
            MemoryStream outstream = new MemoryStream();
            Dump         dump      = GenerateTestDump();

            saver.Save(dump, dumpFormat, outstream);
            byte[] buffer = outstream.ToArray();

            Stream       stream = new MemoryStream(buffer);
            BinaryReader reader = new BinaryReader(stream);

            ReadAndVerifyHeader(reader, dumpFormat);
            ReadAndVerifyBody(stream, dumpFormat);

            Assert.That(stream.Position, Is.EqualTo(stream.Length),
                        "Should not be any trailing data");
        }
Пример #4
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));
            }
        }