예제 #1
0
 /// <summary>
 /// Deletes a photo
 /// </summary>
 public Task DeletePhotoAsync(Assignment assignment, Photo photo)
 {
     return(service
            .DeletePhotoAsync(photo)
            .ContinueOnCurrentThread(t => {
         if (photos != null)
         {
             photos.Remove(photo);
         }
     }));
 }
예제 #2
0
        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));
        }