Beispiel #1
0
        public ArtistSearchTests()
        {
            artistSearch = new ArtistSearch(ContentLanguagePreference.Default, db.CreateContext(), new EntryUrlParser());

            var artist1 = db.Save(CreateEntry.Artist(ArtistType.Producer, name: "XenonP"));

            db.SaveNames(artist1);
            db.Save(artist1.CreateWebLink("Twitter", "https://twitter.com/XenonP_XM", WebLinkCategory.Official));
            db.SaveNames(db.Save(CreateEntry.Artist(ArtistType.Producer, name: "Clean Tears")));
            db.SaveNames(db.Save(CreateEntry.Artist(ArtistType.Vocaloid, name: "Hatsune Miku")));
        }
Beispiel #2
0
        public void SetUp()
        {
            artist     = CreateEntry.Producer(name: "Tripshots");
            vocalist   = CreateEntry.Vocalist(name: "Hatsune Miku");
            repository = new FakeArtistRepository(artist, vocalist);
            var weblink = new ArtistWebLink(artist, "Website", "http://tripshots.net", WebLinkCategory.Official);

            artist.WebLinks.Add(weblink);
            repository.Save(weblink);
            repository.SaveNames(artist, vocalist);

            user = CreateEntry.User(name: "Miku", group: UserGroupId.Moderator);
            repository.Save(user);
            permissionContext = new FakePermissionContext(user);
            imagePersister    = new InMemoryImagePersister();

            queries = new ArtistQueries(repository, permissionContext, new FakeEntryLinkFactory(), imagePersister, imagePersister, MemoryCache.Default,
                                        new FakeUserIconFactory(), new EnumTranslations());

            newArtistContract = new CreateArtistContract {
                ArtistType  = ArtistType.Producer,
                Description = string.Empty,
                Names       = new[] {
                    new LocalizedStringContract("Tripshots", ContentLanguageSelection.English)
                },
                WebLink = new WebLinkContract("http://tripshots.net/", "Website", WebLinkCategory.Official)
            };
        }
Beispiel #3
0
        public void SetUp()
        {
            _artist     = CreateEntry.Producer(name: "Tripshots");
            _vocalist   = CreateEntry.Vocalist(name: "Hatsune Miku");
            _repository = new FakeArtistRepository(_artist, _vocalist);
            var weblink = new ArtistWebLink(_artist, "Website", "http://tripshots.net", WebLinkCategory.Official, disabled: false);

            _artist.WebLinks.Add(weblink);
            _repository.Save(weblink);
            _repository.SaveNames(_artist, _vocalist);

            _user  = CreateEntry.User(name: "Miku", group: UserGroupId.Moderator);
            _user2 = CreateEntry.User(name: "Rin", group: UserGroupId.Regular);
            _repository.Save(_user);
            _permissionContext = new FakePermissionContext(_user);
            _imagePersister    = new InMemoryImagePersister();

            _queries = new ArtistQueries(
                _repository,
                _permissionContext,
                new FakeEntryLinkFactory(),
                _imagePersister,
                _imagePersister,
                MemoryCache.Default,
                new FakeUserIconFactory(),
                new EnumTranslations(),
                _imagePersister,
                new FakeDiscordWebhookNotifier());

            _newArtistContract = new CreateArtistContract
            {
                ArtistType  = ArtistType.Producer,
                Description = string.Empty,
                Names       = new[] {
                    new LocalizedStringContract("Tripshots", ContentLanguageSelection.English)
                },
                WebLink = new WebLinkContract("http://tripshots.net/", "Website", WebLinkCategory.Official, disabled: false)
            };
        }
Beispiel #4
0
        public async Task Update_OriginalName_UpdateArtistStrings()
        {
            _artist.Names.Names.Clear();
            _artist.Names.Add(new ArtistName(_artist, new LocalizedString("初音ミク", ContentLanguageSelection.Japanese)));
            _artist.Names.Add(new ArtistName(_artist, new LocalizedString("Hatsune Miku", ContentLanguageSelection.Romaji)));
            _artist.TranslatedName.DefaultLanguage = ContentLanguageSelection.Japanese;
            _artist.Names.UpdateSortNames();
            _repository.SaveNames(_artist);

            var song = _repository.Save(CreateEntry.Song());

            _repository.Save(song.AddArtist(_artist));
            song.UpdateArtistString();

            song.ArtistString[ContentLanguagePreference.Default].Should().Be("初音ミク", "Precondition: default name");

            var contract = new ArtistForEditContract(_artist, ContentLanguagePreference.English, new InMemoryImagePersister());

            contract.DefaultNameLanguage = ContentLanguageSelection.English;

            await CallUpdate(contract);

            song.ArtistString[ContentLanguagePreference.Default].Should().Be("Hatsune Miku", "Default name was updated");
        }
Beispiel #5
0
        public void Update_OriginalName_UpdateArtistStrings()
        {
            artist.Names.Names.Clear();
            artist.Names.Add(new ArtistName(artist, new LocalizedString("初音ミク", ContentLanguageSelection.Japanese)));
            artist.Names.Add(new ArtistName(artist, new LocalizedString("Hatsune Miku", ContentLanguageSelection.Romaji)));
            artist.TranslatedName.DefaultLanguage = ContentLanguageSelection.Japanese;
            artist.Names.UpdateSortNames();
            repository.SaveNames(artist);

            var song = repository.Save(CreateEntry.Song());

            repository.Save(song.AddArtist(artist));
            song.UpdateArtistString();

            Assert.AreEqual("初音ミク", song.ArtistString[ContentLanguagePreference.Default], "Precondition: default name");

            var contract = new ArtistForEditContract(artist, ContentLanguagePreference.English, new InMemoryImagePersister());

            contract.DefaultNameLanguage = ContentLanguageSelection.English;

            CallUpdate(contract);

            Assert.AreEqual("Hatsune Miku", song.ArtistString[ContentLanguagePreference.Default], "Default name was updated");
        }