Example #1
0
        public void XmlRom_CreateUninitializedRomAnd_ValidateThrowsArgumentNullException()
        {
            XmlFormatRomTestStorageAccess.Initialize();
            var rom = new XmlRom();

            Assert.Throws <ArgumentNullException>(() => rom.Validate());
        }
Example #2
0
        public void XmlRom_SetToValidLuigiPath_BecomesValid()
        {
            var romPath = XmlFormatRomTestStorageAccess.Initialize(TestRomResources.TestLuigiFromBinPath).First();
            var rom     = new XmlRom();

            rom.UpdateRomPath(romPath);

            Assert.True(rom.IsValid);
            Assert.NotNull(rom.ResolvedRom);
            Assert.Equal(RomFormat.Luigi, rom.Format);
            Assert.Equal(romPath, rom.RomPath);
            Assert.Equal(null, rom.ConfigPath);
            Assert.Equal(TestRomResources.TestBinCrc, rom.Crc);    // LUIGI should return original .BIN ROM's CRC
            Assert.Equal(TestRomResources.TestCfgCrc, rom.CfgCrc); // LUIGI should return original .CFG file's CRC
            Assert.True(rom.Validate());
        }
Example #3
0
        public void XmlRom_SetToValidRomPath_BecomesValid()
        {
            var romPath = XmlFormatRomTestStorageAccess.Initialize(TestRomResources.TestRomPath).First();
            var rom     = new XmlRom();

            rom.UpdateRomPath(romPath);

            Assert.True(rom.IsValid);
            Assert.NotNull(rom.ResolvedRom);
            Assert.Equal(RomFormat.Rom, rom.Format);
            Assert.Equal(romPath, rom.RomPath);
            Assert.Equal(null, rom.ConfigPath);
            Assert.Equal(TestRomResources.TestRomCrc, rom.Crc);
            Assert.Equal(0u, rom.CfgCrc);
            Assert.True(rom.Validate());
        }
Example #4
0
        public void XmlRom_SetToValidRomPathChangeToAnotherValidPath_RemainsValid()
        {
            var paths = XmlFormatRomTestStorageAccess.Initialize(TestRomResources.TestRomPath, TestRomResources.TestRomMetadataPath);
            var rom   = new XmlRom();

            rom.UpdateRomPath(paths[0]);
            Assert.True(rom.IsValid);
            Assert.Equal(TestRomResources.TestRomCrc, rom.Crc);
            Assert.Equal(paths[0], rom.RomPath);

            rom.UpdateRomPath(paths[1]);

            Assert.True(rom.IsValid);
            Assert.NotNull(rom.ResolvedRom);
            Assert.Equal(RomFormat.Rom, rom.Format);
            Assert.Equal(paths[1], rom.RomPath);
            Assert.Equal(null, rom.ConfigPath);
            Assert.Equal(TestRomResources.TestRomMetadataCrc, rom.Crc);
            Assert.Equal(0u, rom.CfgCrc);
            Assert.True(rom.Validate());
        }
Example #5
0
        public void XmlRom_SetToValidRomPathChangeToValidBinPathWithDifferentFormat_RemainsValid()
        {
            var paths = XmlFormatRomTestStorageAccess.Initialize(TestRomResources.TestRomPath, TestRomResources.TestBinPath, TestRomResources.TestCfgPath);
            var rom   = new XmlRom();

            rom.UpdateRomPath(paths[0]);
            Assert.True(rom.IsValid);
            Assert.Equal(TestRomResources.TestRomCrc, rom.Crc);
            Assert.Equal(paths[0], rom.RomPath);
            Assert.Equal(RomFormat.Rom, rom.Format);

            rom.UpdateRomPath(paths[1]);
            rom.UpdateConfigPath(paths[2]);

            Assert.True(rom.IsValid);
            Assert.NotNull(rom.ResolvedRom);
            Assert.Equal(RomFormat.Bin, rom.Format);
            Assert.Equal(paths[1], rom.RomPath);
            Assert.Equal(paths[2], rom.ConfigPath);
            Assert.Equal(TestRomResources.TestBinCrc, rom.Crc);
            Assert.Equal(TestRomResources.TestCfgCrc, rom.CfgCrc);
            Assert.True(rom.Validate());
        }