示例#1
0
        public void Rom_GetRefreshedCrcsFromNullPaths_ThrowsAgumentNullException()
        {
            RomTestStorageAccess.Initialize();

            var cfgCrc = 0u;

            Assert.Throws <ArgumentNullException>(() => Rom.GetRefreshedCrcs(null, null, out cfgCrc));
        }
示例#2
0
        public void Rom_GetRefreshedCrcsFromNullBinPathAndValidCfgPath_ThrowsAgumentNullException()
        {
            var cfgPath = RomTestStorageAccess.Initialize(TestRomResources.TestCfgPath).First();

            var cfgCrc = 0u;

            Assert.Throws <ArgumentNullException>(() => Rom.GetRefreshedCrcs(null, cfgPath, out cfgCrc));
        }
示例#3
0
        public void Rom_GetComparisonIgnoreRangesFromNullRom_ReturnsEmptyEnumerable(bool excludeFeatureBits)
        {
            RomTestStorageAccess.Initialize();

            var ignoreRanges = Rom.GetComparisonIgnoreRanges(null, excludeFeatureBits);

            Assert.False(ignoreRanges.Any());
        }
示例#4
0
        public void Rom_GetLuigiHeaderFromLuigiRom_ReturnsHeader()
        {
            var romPath = RomTestStorageAccess.Initialize(TestRomResources.TestLuigiFromBinPath).First();
            var rom     = Rom.Create(romPath, null);

            Assert.NotNull(rom);

            Assert.NotNull(Rom.GetLuigiHeader(rom));
        }
示例#5
0
        public void Rom_GetRefreshedCrcsFromBinPathAndNullCfgPath_GetsCorrectBinCrcAndZeroCfgCrc()
        {
            var romPath = RomTestStorageAccess.Initialize(TestRomResources.TestBinPath).First();

            var cfgCrc = 0u;
            var crc    = Rom.GetRefreshedCrcs(romPath, null, out cfgCrc);

            Assert.Equal(TestRomResources.TestBinCrc, crc);
            Assert.Equal(0u, cfgCrc);
        }
示例#6
0
        public void Rom_GetComparisonIgnoreRangesFromLuigiRom_ReturnsNonEmptyEnumerable(bool excludeFeatureBits)
        {
            var romPath = RomTestStorageAccess.Initialize(TestRomResources.TestLuigiFromBinPath).First();
            var rom     = Rom.Create(romPath, null);

            Assert.NotNull(rom);

            var ignoreRanges = Rom.GetComparisonIgnoreRanges(rom, excludeFeatureBits);

            Assert.True(ignoreRanges.Count() > 0); // Count() forces foreach in Rom.GetComparisonIgnoreRanges to execute
        }
示例#7
0
        public void Rom_GetRefreshedCrcsFromValidBinAndCfgPaths_GetsCorrectBinAndCfgCrcs(string testRomPath, string testCfgPath, uint expectedRomCrc, uint expectedCfgCrc)
        {
            var paths   = RomTestStorageAccess.Initialize(testRomPath, testCfgPath);
            var romPath = paths[0];
            var cfgPath = testCfgPath == null ? null : paths[1];

            var cfgCrc = 0u;
            var crc    = Rom.GetRefreshedCrcs(romPath, cfgPath, out cfgCrc);

            Assert.Equal(expectedRomCrc, crc);
            Assert.Equal(expectedCfgCrc, cfgCrc);
        }
示例#8
0
        public void Rom_GetComparisonIgnoreRangesFromNonLuigiRom_ReturnsEmptyEnumerable(string testRomPath, string testCfgPath, bool excludeFeatureBits)
        {
            var paths   = RomTestStorageAccess.Initialize(testRomPath, testCfgPath);
            var romPath = paths[0];
            var cfgPath = testCfgPath == null ? null : paths[1];
            var rom     = Rom.Create(romPath, cfgPath);

            Assert.NotNull(rom);

            var ignoreRanges = Rom.GetComparisonIgnoreRanges(rom, excludeFeatureBits);

            Assert.False(ignoreRanges.Any());
        }
示例#9
0
        public void Rom_ReplaceCfgOnNonBinFormatRom_HasNoEffect()
        {
            var paths = RomTestStorageAccess.Initialize(TestRomResources.TestRomPath, TestRomResources.TestCfgPath, TestRomResources.TestCfgMetadataPath);
            var rom   = Rom.Create(paths[0], paths[1]);

            Assert.NotNull(rom);
            Assert.Equal(paths[0], rom.RomPath);
            Assert.Null(rom.ConfigPath);
            Assert.Equal(0u, rom.CfgCrc);

            Rom.ReplaceCfgPath(rom, paths[2]);

            Assert.Null(rom.ConfigPath);
            Assert.Equal(0u, rom.CfgCrc);
        }
示例#10
0
        public void Rom_ReplaceCfgWithDifferentValidCfgPath_UpdatesConfigPath()
        {
            var paths = RomTestStorageAccess.Initialize(TestRomResources.TestBinPath, TestRomResources.TestCfgPath, TestRomResources.TestCfgMetadataPath);
            var rom   = Rom.Create(paths[0], paths[1]);

            Assert.NotNull(rom);
            Assert.Equal(paths[0], rom.RomPath);
            Assert.Equal(paths[1], rom.ConfigPath);
            Assert.Equal(TestRomResources.TestCfgCrc, rom.CfgCrc);

            Rom.ReplaceCfgPath(rom, paths[2]);

            Assert.Equal(paths[2], rom.ConfigPath);
            Assert.Equal(TestRomResources.TestMetadataCfgCrc, rom.CfgCrc);
        }
示例#11
0
        public void Rom_ReplaceCfgWithNullCfgPath_RemovesConfigPath()
        {
            var paths = RomTestStorageAccess.Initialize(TestRomResources.TestBinPath, TestRomResources.TestCfgPath);
            var rom   = Rom.Create(paths[0], paths[1]);

            Assert.NotNull(rom);
            Assert.Equal(paths[0], rom.RomPath);
            Assert.Equal(paths[1], rom.ConfigPath);
            Assert.Equal(TestRomResources.TestCfgCrc, rom.CfgCrc);

            Rom.ReplaceCfgPath(rom, null);

            Assert.Null(rom.ConfigPath);
            Assert.Equal(0u, rom.CfgCrc);
        }
示例#12
0
        public void Rom_ReplaceCfgWithNonexistentCfgPath_UpdatesConfigPath()
        {
            var paths = RomTestStorageAccess.Initialize(TestRomResources.TestBinPath, TestRomResources.TestCfgPath);
            var rom   = Rom.Create(paths[0], paths[1]);

            Assert.NotNull(rom);
            Assert.Equal(paths[0], rom.RomPath);
            Assert.Equal(paths[1], rom.ConfigPath);
            Assert.Equal(TestRomResources.TestCfgCrc, rom.CfgCrc);

            var invalidCfgPath = "/Resources/Totes/Bogus/Cfg.cfg";

            Rom.ReplaceCfgPath(rom, invalidCfgPath);

            Assert.Equal(invalidCfgPath, rom.ConfigPath);
            Assert.Equal(0u, rom.CfgCrc);
        }
示例#13
0
        public void Rom_GetLuigiHeaderFromNullRom_ReturnsNull()
        {
            RomTestStorageAccess.Initialize();

            Assert.Null(Rom.GetLuigiHeader(null));
        }
示例#14
0
        public void Rom_ReplaceCfgOnNullRomWithValidCfgPath_DoesNotThrow()
        {
            var cfgPath = RomTestStorageAccess.Initialize(TestRomResources.TestCfgPath).First();

            Rom.ReplaceCfgPath(null, cfgPath);
        }
示例#15
0
        public void Rom_ReplaceCfgOnNullRomWithNullCfgPath_DoesNotThrow()
        {
            RomTestStorageAccess.Initialize();

            Rom.ReplaceCfgPath(null, null);
        }