public void Delete(int id, string notes = "", bool hardDelete = false) { notes ??= string.Empty; if (hardDelete) { _queries.MoveToTrash(id, notes); } else { _queries.Delete(id, notes); } }
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); 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"); }); }