/// <summary> /// Deletes a photo /// </summary> public Task DeletePhotoAsync(Assignment assignment, Photo photo) { return(service .DeletePhotoAsync(photo) .ContinueOnCurrentThread(t => { if (photos != null) { photos.Remove(photo); } })); }
public void DeletePhoto() { var assignmentTask = service.GetAssignmentsAsync(CancellationToken.None); assignmentTask.Wait(); var assignment = assignmentTask.Result.First(); var photo = new Photo { AssignmentId = assignment.Id, Image = new byte [] { 255 } }; var task = service.SavePhotoAsync(photo, CancellationToken.None); task.Wait(); var deleteTask = service.DeletePhotoAsync(photo, CancellationToken.None); deleteTask.Wait(); Assert.That(deleteTask.Result, Is.EqualTo(1)); }