private SongForEditContract Update(SongForEditContract contract) { return(context.RunTest(repository => { var queries = Queries(repository); var updated = queries.UpdateBasicProperties(contract); return queries.GetSongForEdit(updated.Id); })); }
private ReleaseEventForEditContract Update(ReleaseEventForEditContract contract) { return(context.RunTest(repository => { var queries = new EventQueries(repository, entryLinkFactory, userContext, imageStore, userIconFactory, enumTranslations, mailer); var updated = queries.Update(contract, null); return queries.GetEventForEdit(updated.Id); })); }
private ReleaseEventForEditContract Update(ReleaseEventForEditContract contract) { return(context.RunTest(repository => { var queries = new EventQueries(repository, entryLinkFactory, userContext, imageStore, userIconFactory, enumTranslations, mailer, new FollowedArtistNotifier(new FakeEntryLinkFactory(), new FakeUserMessageMailer(), new EnumTranslations(), new EntrySubTypeNameFactory())); var updated = queries.Update(contract, null); return queries.GetEventForEdit(updated.Id); })); }
private TagForApiContract Merge(int sourceId, int targetId) { var permissionContext = new FakePermissionContext(new UserWithPermissionsContract(Db.UserWithEditPermissions, ContentLanguagePreference.Default)); return(context.RunTest(repository => { var queries = new TagQueries(repository, permissionContext, new FakeEntryLinkFactory(), new InMemoryImagePersister(), new InMemoryImagePersister(), new FakeUserIconFactory(), new EnumTranslations()); queries.Merge(sourceId, targetId); var result = queries.LoadTag(targetId, t => new TagForApiContract(t, ContentLanguagePreference.English, TagOptionalFields.None)); return result; })); }
public void Delete() { context.RunTest(repository => { var queries = new EventQueries(repository, new FakeEntryLinkFactory(), userContext, new InMemoryImagePersister()); queries.Delete(Db.ReleaseEvent.Id); }); }
private PartialFindResult <Song> CallFind(ContentLanguagePreference languagePreference = ContentLanguagePreference.Default) { return(context.RunTest(querySource => { var search = new Model.Service.Search.SongSearch.SongSearch(querySource, languagePreference, entryUrlParser); var watch = new Stopwatch(); watch.Start(); var result = search.Find(queryParams); Console.WriteLine("Test finished in {0}ms", watch.ElapsedMilliseconds); return result; })); }
private PartialFindResult <Tag> CallFind(ContentLanguagePreference languagePreference = ContentLanguagePreference.Default, bool onlyMinimalFields = false) { return(context.RunTest(querySource => { var search = new TagSearch(querySource.OfType <Tag>(), languagePreference); var watch = new Stopwatch(); watch.Start(); var result = search.Find(queryParams, onlyMinimalFields); Console.WriteLine("Test finished in {0}ms", watch.ElapsedMilliseconds); return result; })); }
public void MoveToTrash() { userContext.GrantPermission(PermissionToken.MoveToTrash); context.RunTest(repository => { var id = Db.ReleaseEvent.Id; var queries = new EventQueries(repository, entryLinkFactory, userContext, imageStore, userIconFactory, enumTranslations, mailer, new FollowedArtistNotifier(new FakeEntryLinkFactory(), new FakeUserMessageMailer(), new EnumTranslations(), new EntrySubTypeNameFactory()), imageStore); queries.MoveToTrash(id, "Deleted"); var query = repository.HandleQuery(ctx => { return(new { EventFromDb = ctx.Get(id), TrashedEntry = ctx.Query <TrashedEntry>().FirstOrDefault(e => e.EntryType == EntryType.ReleaseEvent && e.EntryId == id) }); }); Assert.IsNull(query.EventFromDb, "Release event was deleted"); Assert.IsNotNull(query.TrashedEntry, "Trashed entry was created"); Assert.AreEqual("Deleted", query.TrashedEntry.Notes, "TrashedEntry.Notes"); }); }
private Tag[] WhereHasName(params string[] names) { return(context.RunTest(ctx => { return ctx.Query <Tag>().WhereHasName(names).ToArray(); })); }