Exemple #1
0
        public void CannotBurnRomTwice()
        {
            _rom.Erase();
            _rom.Burn = true;

            var end = (ushort)(ROM_START + ROM_SIZE - 1);

            for (var ix = ROM_START; ix <= end; ix++)
            {
                mem.Write(ix, 0x55);
            }

            _rom.Burn = false; // End burning

            Assert.IsTrue(IsMemoryFilledWith(mem, ROM_START, ROM_SIZE, 0x55), "ROM unexpected content");

            for (var ix = ROM_START; ix <= end; ix++)
            {
                mem.Write(ix, 0xAA);
            }

            // Content should not have changed
            Assert.IsTrue(IsMemoryFilledWith(mem, ROM_START, ROM_SIZE, 0x55), "ROM unexpected content");

            try
            {
                _rom.Burn = true; // Should fail
            }
            catch (InvalidOperationException)
            {
                Assert.Pass();
            }

            Assert.Fail("Exception wasn't thrown");
        }