Ejemplo n.º 1
0
        public void Rom_GetRefreshedCrcsFromNullPaths_ThrowsAgumentNullException()
        {
            RomTestStorageAccess.Initialize();

            var cfgCrc = 0u;

            Assert.Throws <ArgumentNullException>(() => Rom.GetRefreshedCrcs(null, null, out cfgCrc));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 3
0
        public void Rom_GetComparisonIgnoreRangesFromNullRom_ReturnsEmptyEnumerable(bool excludeFeatureBits)
        {
            RomTestStorageAccess.Initialize();

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

            Assert.False(ignoreRanges.Any());
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 13
0
        public void Rom_GetLuigiHeaderFromNullRom_ReturnsNull()
        {
            RomTestStorageAccess.Initialize();

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

            Rom.ReplaceCfgPath(null, cfgPath);
        }
Ejemplo n.º 15
0
        public void Rom_ReplaceCfgOnNullRomWithNullCfgPath_DoesNotThrow()
        {
            RomTestStorageAccess.Initialize();

            Rom.ReplaceCfgPath(null, null);
        }