Beispiel #1
0
        public void TestMbr()
        {
            MemoryStream ms = new MemoryStream();
            ms.SetLength(1024 * 1024);

            byte[] newMbr = new byte[512];
            for (int i = 0; i < 512; i++)
            {
                newMbr[i] = (byte)i;
            }

            Raw.Disk rawDisk = new DiscUtils.Raw.Disk(ms, Ownership.Dispose);
            rawDisk.SetMasterBootRecord(newMbr);

            byte[] readMbr = rawDisk.GetMasterBootRecord();
            Assert.AreEqual(512, readMbr.Length);

            for (int i = 0; i < 512; i++)
            {
                if (readMbr[i] != (byte)i)
                {
                    Assert.Fail("Mismatch on byte {0}, expected {1} was {2}", i, (byte)i, readMbr[i]);
                }
            }
        }
        public void TestMbr()
        {
            MemoryStream ms = new MemoryStream();

            ms.SetLength(1024 * 1024);

            byte[] newMbr = new byte[512];
            for (int i = 0; i < 512; i++)
            {
                newMbr[i] = (byte)i;
            }

            Raw.Disk rawDisk = new DiscUtils.Raw.Disk(ms, Ownership.Dispose);
            rawDisk.SetMasterBootRecord(newMbr);

            byte[] readMbr = rawDisk.GetMasterBootRecord();
            Assert.AreEqual(512, readMbr.Length);

            for (int i = 0; i < 512; i++)
            {
                if (readMbr[i] != (byte)i)
                {
                    Assert.Fail("Mismatch on byte {0}, expected {1} was {2}", i, (byte)i, readMbr[i]);
                }
            }
        }
Beispiel #3
0
        public void TestMbr_Null()
        {
            MemoryStream ms = new MemoryStream();
            ms.SetLength(1024 * 1024);

            Raw.Disk rawDisk = new DiscUtils.Raw.Disk(ms, Ownership.Dispose);
            rawDisk.SetMasterBootRecord(null);
        }
        public void TestMbr_WrongSize()
        {
            MemoryStream ms = new MemoryStream();

            ms.SetLength(1024 * 1024);

            Raw.Disk rawDisk = new DiscUtils.Raw.Disk(ms, Ownership.Dispose);
            rawDisk.SetMasterBootRecord(new byte[511]);
        }
        public void TestMbr_Null()
        {
            MemoryStream ms = new MemoryStream();

            ms.SetLength(1024 * 1024);

            Raw.Disk rawDisk = new DiscUtils.Raw.Disk(ms, Ownership.Dispose);
            rawDisk.SetMasterBootRecord(null);
        }
        public void TestMbr_WrongSize()
        {
            MemoryStream ms = new MemoryStream();

            ms.SetLength(1024 * 1024);

            DiscUtils.Raw.Disk rawDisk = new DiscUtils.Raw.Disk(ms, Ownership.Dispose);
            Assert.Throws <ArgumentException>(() => rawDisk.SetMasterBootRecord(new byte[511]));
        }
Beispiel #7
0
        public void TestMbr_WrongSize()
        {
            MemoryStream ms = new MemoryStream();
            ms.SetLength(1024 * 1024);

            Raw.Disk rawDisk = new DiscUtils.Raw.Disk(ms, Ownership.Dispose);
            rawDisk.SetMasterBootRecord(new byte[511]);
        }