public void MoveToTrash() { user.AdditionalPermissions.Add(PermissionToken.MoveToTrash); permissionContext.RefreshLoggedUser(repository); var activityEntry = repository.Save(new AlbumActivityEntry(album, EntryEditEvent.Updated, user, null)); Assert.IsTrue(repository.Contains(album), "Album is in repository"); Assert.IsTrue(repository.Contains(activityEntry), "Activity entry is in repository"); var result = queries.MoveToTrash(album.Id); Assert.IsFalse(repository.Contains(album), "Album was deleted from repository"); Assert.IsFalse(repository.Contains(activityEntry), "Activity entry was deleted from repository"); var trashedFromRepo = repository.Load<TrashedEntry>(result); Assert.IsNotNull(trashedFromRepo, "Trashed entry was created"); Assert.AreEqual(EntryType.Album, trashedFromRepo.EntryType, "Trashed entry type"); Assert.AreEqual(album.DefaultName, trashedFromRepo.Name, "Trashed entry name"); }
public void MoveToTrash() { _user.AdditionalPermissions.Add(PermissionToken.MoveToTrash); _permissionContext.RefreshLoggedUser(_repository); var activityEntry = _repository.Save(new AlbumActivityEntry(_album, EntryEditEvent.Updated, _user, null)); _repository.Contains(_album).Should().BeTrue("Album is in repository"); _repository.Contains(activityEntry).Should().BeTrue("Activity entry is in repository"); var result = _queries.MoveToTrash(_album.Id); _repository.Contains(_album).Should().BeFalse("Album was deleted from repository"); _repository.Contains(activityEntry).Should().BeFalse("Activity entry was deleted from repository"); var trashedFromRepo = _repository.Load <TrashedEntry>(result); trashedFromRepo.Should().NotBeNull("Trashed entry was created"); trashedFromRepo.EntryType.Should().Be(EntryType.Album, "Trashed entry type"); trashedFromRepo.Name.Should().Be(_album.DefaultName, "Trashed entry name"); }