public void SetUp() { artist = CreateEntry.Producer(name: "Tripshots"); repository = new FakeArtistRepository(artist); foreach (var name in artist.Names) repository.Save(name); user = CreateEntry.User(name: "Miku"); repository.Save(user); permissionContext = new FakePermissionContext(user); imagePersister = new InMemoryImagePersister(); queries = new ArtistQueries(repository, permissionContext, new FakeEntryLinkFactory(), imagePersister, MemoryCache.Default); 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) }; }
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) }; }
public void Update_ArtistLinks() { // Arrange var circle = repository.Save(CreateEntry.Circle()); var illustrator = repository.Save(CreateEntry.Artist(ArtistType.Illustrator)); var contract = new ArtistForEditContract(vocalist, ContentLanguagePreference.English) { Groups = new[] { new ArtistForArtistContract { Parent = new ArtistContract(circle, ContentLanguagePreference.English) }, }, Illustrator = new ArtistContract(illustrator, ContentLanguagePreference.English) }; // Act CallUpdate(contract); // Assert var artistFromRepo = repository.Load(contract.Id); Assert.AreEqual(2, artistFromRepo.AllGroups.Count, "Number of groups"); Assert.IsTrue(artistFromRepo.HasGroup(circle), "Has group"); Assert.IsTrue(artistFromRepo.HasGroup(illustrator), "Has illustrator"); Assert.AreEqual(ArtistLinkType.Group, artistFromRepo.Groups.First(g => g.Parent.Equals(circle)).LinkType, "Artist link type for circle"); Assert.AreEqual(ArtistLinkType.Illustrator, artistFromRepo.Groups.First(g => g.Parent.Equals(illustrator)).LinkType, "Artist link type for illustrator"); }
public void SetUp() { artist = CreateEntry.Producer(name: "Tripshots"); repository = new FakeArtistRepository(artist); foreach (var name in artist.Names) { repository.Save(name); } user = CreateEntry.User(name: "Miku"); repository.Save(user); permissionContext = new FakePermissionContext(user); imagePersister = new InMemoryImagePersister(); queries = new ArtistQueries(repository, permissionContext, new FakeEntryLinkFactory(), imagePersister, imagePersister, MemoryCache.Default); 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) }; }
public void CreateReport() { var editor = _user2; _repository.Save(ArchivedArtistVersion.Create(_artist, new ArtistDiff(), new AgentLoginData(editor), ArtistArchiveReason.PropertiesUpdated, string.Empty)); var(created, report) = CallCreateReport(ArtistReportType.InvalidInfo); created.Should().BeTrue("Report was created"); report.EntryBase.Id.Should().Be(_artist.Id); report.User.Should().Be(_user); report.ReportType.Should().Be(ArtistReportType.InvalidInfo); var notification = _repository.List <UserMessage>().FirstOrDefault(); notification.Should().NotBeNull("notification was created"); notification.Receiver.Should().Be(editor, "notification receiver is editor"); notification.Subject.Should().Be(string.Format(EntryReportStrings.EntryVersionReportTitle, _artist.DefaultName)); }
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) }; }
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"))); }
public void GetTagSuggestions() { var song = repository.Save(CreateEntry.Song()); }