public void MergedProgramInformationTable_MergedWithEmptyTable_HasNoPrograms()
        {
            var mergedInformationTable = new MergedProgramInformationTable();

            var emptyTable = new TestProgramInformationTable();

            mergedInformationTable.MergeTable(emptyTable);

            Assert.False(mergedInformationTable.Programs.Any());
        }
        public void MergedProgramInformationTable_MergedWithNonEmptyTable_HasPrograms()
        {
            var mergedInformationTable = new MergedProgramInformationTable();

            var testProgramInformation = new TestProgramInformation()
            {
                Title = "Marty McTesterson", Features = ProgramFeatures.GetUnrecognizedRomFeatures()
            };

            testProgramInformation.AddCrcs(1);
            var table = new TestProgramInformationTable();

            table.AddEntries(testProgramInformation);
            mergedInformationTable.MergeTable(table);

            Assert.True(mergedInformationTable.Programs.Any());
        }
        public void MergedProgramInformationTable_FindRomWithProgramIdentifier_FindsInformationAsExpected()
        {
            var mergedInformationTable = new MergedProgramInformationTable();
            var testProgramIdentifier  = new ProgramIdentifier(0x123u, 0x456u);
            var testProgramInformation = new TestProgramInformation()
            {
                Title = "Buffy Buckingham", Features = ProgramFeatures.GetUnrecognizedRomFeatures()
            };

            testProgramInformation.AddCrcs(3);
            testProgramInformation.AddCrc(testProgramIdentifier.DataCrc, "Version 0", IncompatibilityFlags.Tutorvision, testProgramIdentifier.OtherData);
            var table = new TestProgramInformationTable();

            table.AddEntries(testProgramInformation);
            mergedInformationTable.MergeTable(table);

            var foundInformation = mergedInformationTable.FindProgram(testProgramIdentifier);

            Assert.NotNull(foundInformation);
        }
Example #4
0
        public void ProgramDescription_SetCrcWhenFoundInDatabase_UpdatesCrc()
        {
            var information = new TestProgramInformation();
            var crc         = 1u;

            information.AddCrc(crc);
            var newCrc = 0x32547698u;

            information.AddCrc(newCrc);
            var description = new ProgramDescription(crc, null, information);
            var testTable   = new TestProgramInformationTable();

            testTable.AddEntries(information);
            var defaultTable = ProgramInformationTable.Default as MergedProgramInformationTable; // Eewwww!

            defaultTable.MergeTable(testTable);

            description.Crc = newCrc;

            Assert.Equal(newCrc, description.Crc);
        }