public void WhenArtistDoesNotMatchNothingChanges() { var originalSongName = "dis one"; var artistNameToRemap = "joe"; var originalSongPack = "thepack"; var newArtistName = "doug"; var newSongName = "dee other one"; var newSongPack = "ivechanged"; var artistNameDoesntMatch = "freddy"; var remapEntries = new RemapOfficialEntries(); remapEntries.Entries.Add(new RemapOfficialEntries.Entry { Artist = artistNameToRemap, NewArtist = newArtistName, Song = originalSongName, NewSong = newSongName, NewSongPack = newSongPack }); var mapper = new OfficialDlcRemapper(remapEntries); var officialDlcItem = new OfficialDlcItem { Artist = artistNameDoesntMatch, Song = originalSongName, SongPack = originalSongPack, Genre = "hippy", Year = "1969" }; var remapped = mapper.Remap(officialDlcItem); remapped.Artist.ShouldBe(artistNameDoesntMatch); remapped.Song.ShouldBe(originalSongName); remapped.SongPack.ShouldBe(originalSongPack); officialDlcItem.Artist.ShouldBe(artistNameDoesntMatch); officialDlcItem.Song.ShouldBe(originalSongName); officialDlcItem.SongPack.ShouldBe(originalSongPack); }
public void IfArtistAndSongAndNoChangesSpecifiedThenNothingChanges() { var originalSongName = "dis one"; var artistNameToRemap = "joe"; var originalSongPack = "thepack"; var remapEntries = new RemapOfficialEntries(); remapEntries.Entries.Add(new RemapOfficialEntries.Entry { Artist = artistNameToRemap, Song = originalSongName }); var mapper = new OfficialDlcRemapper(remapEntries); var officialDlcItem = new OfficialDlcItem { Artist = artistNameToRemap, Song = originalSongName, SongPack = originalSongPack, Genre = "hippy", Year = "1969" }; var remapped = mapper.Remap(officialDlcItem); remapped.Artist.ShouldBe(artistNameToRemap); remapped.Song.ShouldBe(originalSongName); remapped.SongPack.ShouldBe(originalSongPack); officialDlcItem.Artist.ShouldBe(artistNameToRemap); officialDlcItem.Song.ShouldBe(originalSongName); officialDlcItem.SongPack.ShouldBe(originalSongPack); }
public void WhenArtistAndSongRemappedBothChange() { var originalSongName = "dis one"; var artistName = "joe"; var newArtistName = "doug"; var newSongName = "dee other one"; var remapEntries = new RemapOfficialEntries(); remapEntries.Entries.Add(new RemapOfficialEntries.Entry { Artist = artistName, NewArtist = newArtistName, Song = originalSongName, NewSong = newSongName }); var mapper = new OfficialDlcRemapper(remapEntries); var officialDlcItem = new OfficialDlcItem { Artist = artistName, Song = originalSongName, SongPack = "blah", Genre = "hippy", Year = "1969" }; var remapped = mapper.Remap(officialDlcItem); remapped.Artist.ShouldBe(newArtistName); remapped.Song.ShouldBe(newSongName); officialDlcItem.Artist.ShouldBe(artistName); officialDlcItem.Song.ShouldBe(originalSongName); }
private bool UpdateOfficialDlcItemRow(OfficialDlcItem target, OfficialDlcItem source) { SetCommonDlcFieldsForUpdate(target, source); target.Genre = source.Genre; target.SongPack = source.SongPack; return(true); }
public OfficialDlcItem Remap(OfficialDlcItem input) { var remapsForArtist = _entriesByArtist[input.Artist]; if (!remapsForArtist.Any()) { return(input); } var rv = input.Clone(); foreach (var remap in remapsForArtist) { //if the remap has a song requirement, and the song matches, then remap specific details if (!string.IsNullOrWhiteSpace(remap.Song)) { if (string.Compare(remap.Song, input.Song, StringComparison.CurrentCultureIgnoreCase) == 0) { if (!string.IsNullOrWhiteSpace(remap.NewSong)) { rv.Song = remap.NewSong; } if (!string.IsNullOrWhiteSpace(remap.NewSongPack)) { rv.SongPack = remap.NewSongPack; } rv.Artist = GetArtist(remap, input.Artist); } } else { rv.Artist = GetArtist(remap, input.Artist); } } return(rv); }