public void BinFormatRom_Load_VerifyCrc() { var paths = BinFormatRomTestStorageAccess.Initialize(TestRomResources.TestBinPath, TestRomResources.TestCfgPath); var rom = Rom.Create(paths[0], paths[1]); Assert.Equal(TestRomResources.TestBinCrc, rom.Crc); Assert.Equal(TestRomResources.TestCfgCrc, rom.CfgCrc); }
public void BinFormatRom_LoadAndValidateRomWithoutCfgPath_RomFormatIdentifiedCorrectly() { var path = BinFormatRomTestStorageAccess.Initialize(TestRomResources.TestBinPath).First(); var rom = Rom.Create(path, null); Assert.NotNull(rom); Assert.Equal(RomFormat.Bin, rom.Format); Assert.True(rom.Validate()); }
public void BinFormatRom_LoadAndValidateRomWithOddFileSize_RomFormatIdentifiedCorrectly() { var paths = BinFormatRomTestStorageAccess.Initialize(TestRomResources.TestIntPath, TestRomResources.TestCfgPath); var rom = Rom.Create(paths[0], paths[1]); Assert.NotNull(rom); Assert.Equal(RomFormat.Bin, rom.Format); Assert.True(rom.Validate()); }
public void BinFormatRom_GetMetadataFromCorruptCfgFile_DoesNotThrow() { var paths = BinFormatRomTestStorageAccess.Initialize(TestRomResources.TestBinMetadataPath, TestRomResources.TestCfgCorruptMetadataPath); var rom = Rom.Create(paths[0], paths[1]); var metadata = rom.GetBinFileMetadata(); Assert.NotNull(metadata); }
public void BinFormatRom_GetMetadata_ReturnsExpectedMetadata() { var paths = BinFormatRomTestStorageAccess.Initialize(TestRomResources.TestBinMetadataPath, TestRomResources.TestCfgMetadataPath); var rom = Rom.Create(paths[0], paths[1]); var metadata = rom.GetBinFileMetadata(); Assert.NotNull(metadata); }
public void BinFormatRom_RefreshCfgCrc_NeverRefreshes() { var paths = BinFormatRomTestStorageAccess.Initialize(TestRomResources.TestBinPath, TestRomResources.TestCfgPath); var rom = Rom.Create(paths[0], paths[1]); var changed = true; Assert.Equal(TestRomResources.TestCfgCrc, rom.RefreshCfgCrc(out changed)); Assert.False(changed); }
public void BinFormatRom_GetMetadataFromCorruptCfgFile_BehavesAsExpected() { IReadOnlyList <string> paths; var storageAccess = BinFormatRomTestStorageAccess.Initialize(out paths, TestRomResources.TestBinMetadataPath, TestRomResources.TestCfgBadMetadataPath); var rom = Rom.Create(paths[0], paths[1]); var corrupted = storageAccess.IntroduceCorruption(paths[1]); Assert.True(corrupted); AssertMetadataBehavior(rom); }
public void BinFormatRom_ReplaceCfgPath_CfgPathChanges() { var paths = BinFormatRomTestStorageAccess.Initialize(TestRomResources.TestBinPath, TestRomResources.TestCfgPath); var rom = Rom.Create(paths[0], paths[1]); var fakeCfgPath = "/Resources/tugalong.cfg"; ((BinFormatRom)rom).ReplaceCfgPath(fakeCfgPath); Assert.Equal(fakeCfgPath, rom.ConfigPath); }
public void BinFormatRom_LoadAndValidateRomWithCustomExtension_RomFormatIdentifiedCorrectly() { var customExtension = ".itv"; ProgramFileKind.Rom.AddCustomExtension(customExtension); var paths = BinFormatRomTestStorageAccess.Initialize(TestRomResources.TestItvPath, TestRomResources.TestCfgPath); var rom = Rom.Create(paths[0], paths[1]); Assert.NotNull(rom); Assert.Equal(RomFormat.Bin, rom.Format); Assert.True(rom.Validate()); ProgramFileKind.Rom.RemoveCustomExtension(customExtension); }