Beispiel #1
0
        public void TestSingleStream()
        {
            string filePath = Path.GetTempFileName();

            using (Stream strm = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite)) {
                MSFWriter wr = new MSFWriter(strm);
                wr.PageSize = 4096;

                byte[] sourceData = File.ReadAllBytes(Assembly
                                                      .GetExecutingAssembly()
                                                      .Location);

                wr.StreamTable.AddStream(sourceData);
                wr.Commit();

                strm.Position = 0;
                PDBFile rdr = new PDBFile(strm);
                Assert.AreEqual(rdr.Streams.Count(), 1);

                byte[] streamData = rdr.Streams.First();
                Assert.AreEqual(sourceData, streamData);
            }

            File.Delete(filePath);
        }
Beispiel #2
0
        public void TestHeader()
        {
            MSFWriter wr = new MSFWriter();

            wr.PageSize = 4096;
            wr.Commit();

            MSFReader rdr   = new MSFReader(wr.Memory);
            string    magic = rdr.Header.GetMagic();

            Assert.AreEqual(magic, PDBFile.BIG_MAGIC);
            Assert.AreEqual(rdr.Header.PageSize, 4096);
        }
Beispiel #3
0
        public void TestHeader()
        {
            string filePath = Path.GetTempFileName();

            using (Stream strm = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite)) {
                MSFWriter wr = new MSFWriter(strm);
                wr.PageSize = 4096;
                wr.Commit();

                strm.Position = 0;
                MSFReader rdr = new MSFReader(strm, PDBType.Big);

                Assert.That(Encoding.ASCII
                            .GetString(rdr.Header.Magic)
                            .StartsWith(PDBFile.BIG_MAGIC));
                Assert.AreEqual(rdr.Header.PageSize, 4096);
            }

            File.Delete(filePath);
        }