public void XmlRomInformationToProgramRomInformationConverter_CreateDefaultAndConvertXmlInfoWithMultipleCorruptions_ProducesValidConversion() { var converter = XmlRomInformationToProgramRomInformationConverter.Create(); var columnsToCorrupt = new[] { XmlRomInformationDatabaseColumnName.vendor, XmlRomInformationDatabaseColumnName.short_name, XmlRomInformationDatabaseColumnName.release_date, XmlRomInformationDatabaseColumnName.soundfx, XmlRomInformationDatabaseColumnName.game_docs }; var xmlRomInformation = CreateTestInformationForConversion(XmlInformationKind.FullyPopulated, columnsToCorrupt); xmlRomInformation.GetColumn(XmlRomInformationDatabaseColumnName.build_date).Value = "2020"; // corrupted because it's not YYYY-MM-DD var convertedInformation = converter.Convert(xmlRomInformation); var builder = new ProgramMetadataBuilder().WithInitialMetadata(XmlProgramMetadata.Value); builder.WithPublishers(null).WithShortNames(null).WithReleaseDates(null).WithSoundEffects(null).WithDocumentation(null).WithBuildDates(null); var expectedMetadata = builder.Build(); var expectedProgramInformation = new TestProgramInformation(XmlProgramInformation) { Vendor = null, ShortName = null, Year = null }; var expectedProgramDescription = new TestProgramDescription(XmlProgramDescription) { Vendor = null, ShortName = null, Year = null }; ValidateInformation(expectedProgramInformation, convertedInformation); ValidateDescription(expectedProgramDescription, convertedInformation); ValidateFeatures(XmlProgramFeatures.Value, convertedInformation.Features); ValidateMetadata(expectedMetadata, convertedInformation.Metadata); }
public void ProgramDescription_IsMatchingProgramDescriptionWithMatchingProgramIdentifierMatchingRomFormatCfgCrcMustMatchWithCodeInfoHasMismatchedCode_ReturnsFalse() { var romPaths = ProgramDescriptionHelpersTestStorage.Initialize(TestRomResources.TestBinPath, TestRomResources.TestCfgPath); var rom = Rom.Create(romPaths[0], romPaths[1]); var description = new TestProgramDescription(rom, "tod"); Assert.False(description.IsMatchingProgramDescription(new ProgramIdentifier(rom.Crc, rom.CfgCrc), RomFormat.Bin, cfgCrcMustMatch: true, code: "tag")); }
public TestProgramDescription(TestProgramDescription otherDescription) { Name = otherDescription.Name; ShortName = otherDescription.ShortName; Vendor = otherDescription.Vendor; Year = otherDescription.Year; Features = otherDescription.Features; }
public TestProgramDescription ToDescription() { var description = new TestProgramDescription() { Name = Title, ShortName = ShortName, Vendor = Vendor, Year = Year }; return(description); }
public void XmlRomInformationToProgramRomInformationConverter_CreateWithDescriptionsSourceContainingMatchAndConvertXmlInfo_ProducesValidConversion() { var testProgramDescription = new TestProgramDescription(); var descriptionsSource = new List <IProgramDescription>() { testProgramDescription }; var converter = XmlRomInformationToProgramRomInformationConverter.Create(descriptionsSource); var xmlRomInformation = CreateTestInformationForConversion(XmlInformationKind.FullyPopulated); var convertedInformation = converter.Convert(xmlRomInformation); ValidateInformation(testProgramDescription.ToInformation(), convertedInformation); ValidateDescription(testProgramDescription, convertedInformation); ValidateFeatures(XmlProgramFeatures.Value, convertedInformation.Features); ValidateMetadata(XmlProgramMetadata.Value, convertedInformation.Metadata); }
public void XmlRomInformationToProgramRomInformationConverter_CreateWithDescriptionsSourceContainingMatchWithRomWithMetadatdaAndConvertXmlInfo_ProducesValidConversion() { var romPaths = XmlRomInformationToProgramRomInformationConverterTestStorageAccess.Initialize(TestRomResources.TestBinPath, TestRomResources.TestCfgMetadataPath); var rom = Rom.Create(romPaths[0], romPaths[1]); Assert.NotNull(rom); var testProgramDescription = new TestProgramDescription(rom); var descriptionsSource = new List <IProgramDescription>() { testProgramDescription }; var converter = XmlRomInformationToProgramRomInformationConverter.Create(descriptionsSource); var xmlRomInformation = CreateTestInformationForConversion(XmlInformationKind.FullyPopulated); var convertedInformation = converter.Convert(xmlRomInformation); ValidateInformation(testProgramDescription.ToInformation(), convertedInformation); ValidateDescription(testProgramDescription, convertedInformation); ValidateFeatures(XmlProgramFeatures.Value, convertedInformation.Features); ValidateMetadata(XmlProgramMetadata.Value, convertedInformation.Metadata); }
public void XmlRomInformationToProgramRomInformationConverter_CreateDefaultAndConvertXmlInfoWithZeroReleaseDate_ProducesValidConversion() { var converter = XmlRomInformationToProgramRomInformationConverter.Create(); var xmlRomInformation = CreateTestInformationForConversion(XmlInformationKind.FullyPopulated); xmlRomInformation.GetColumn(XmlRomInformationDatabaseColumnName.release_date).Value = "0000-00-00"; // corrupted because it's not valid, but is correct format var convertedInformation = converter.Convert(xmlRomInformation); var builder = new ProgramMetadataBuilder().WithInitialMetadata(XmlProgramMetadata.Value); var expectedMetadata = builder.WithReleaseDates(null).Build(); var expectedProgramInformation = new TestProgramInformation(XmlProgramInformation) { Year = null }; var expectedProgramDescription = new TestProgramDescription(XmlProgramDescription) { Year = null }; ValidateInformation(expectedProgramInformation, convertedInformation); ValidateDescription(expectedProgramDescription, convertedInformation); ValidateFeatures(XmlProgramFeatures.Value, convertedInformation.Features); ValidateMetadata(expectedMetadata, convertedInformation.Metadata); }