Exemple #1
0
 public void LuigiFormatRom_CheckFormatFromStream_RomFormatIdentifiedCorrectly(string testRomResource, RomFormat expectedRomFormat)
 {
     using (var romData = TestRomResources.OpenResourceStream(testRomResource))
     {
         Assert.NotNull(romData);
         Assert.Equal(expectedRomFormat, LuigiFormatRom.CheckFormat(romData));
     }
 }
Exemple #2
0
        public void LuigiFormatRom_GetCrcsFromFileWithZeroCrcs_CrcMatchesCrcOfFile()
        {
            var romPath = LuigiFormatRomTestStorageAccess.Initialize(TestRomResources.TestLuigiWithZeroCrcsPath).First();

            uint cfgCrc;
            var  crc = LuigiFormatRom.GetCrcs(romPath, null, out cfgCrc);

            Assert.Equal(TestRomResources.TestLuigiWithZeroCrcsCrc, crc);
            Assert.Equal(0u, cfgCrc);
        }
Exemple #3
0
        public void LuigiFormatRom_CheckFormatOfCorruptFile_ThrowsNullReferenceException()
        {
            IReadOnlyList <string> paths;
            var storageAccess = LuigiFormatRomTestStorageAccess.Initialize(out paths, TestRomResources.TestLuigiWithBadHeaderPath);

            var corrupted = storageAccess.IntroduceCorruption(paths.First());

            Assert.True(corrupted);
            Assert.Throws <NullReferenceException>(() => LuigiFormatRom.CheckFormat(paths.First()));
        }
Exemple #4
0
        public void LuigiFormatRom_GetCrcsFromRomOrigin_CrcsMatch()
        {
            var romPath = LuigiFormatRomTestStorageAccess.Initialize(TestRomResources.TestLuigiFromRomPath).First();

            uint cfgCrc;
            var  crc = LuigiFormatRom.GetCrcs(romPath, null, out cfgCrc);

            Assert.Equal(TestRomResources.TestRomCrc, crc);
            Assert.Equal(0u, cfgCrc);
        }