예제 #1
0
 public IActionResult DeletePhoto([FromQuery] Guid[] id)
 {
     try
     {
         foreach (Guid photoId in id)
         {
             Photos.DeleteById(photoId);
         }
         return(Ok());
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
        public void DeletePhoto()
        {
            GoogleServices.SetupSequence(g => g.UploadImage(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()));
            GoogleServices.SetupSequence(g => g.GetImageURL(It.IsAny <string>()))
            .Returns("https://storage.googleapis.com/example");
            GoogleServices.SetupSequence(g => g.GetImageTags(It.IsAny <string>()))
            .Returns(new List <string>());
            GoogleServices.SetupSequence(g => g.DeleteImage(It.IsAny <string>()));

            User  user  = SessionLogic.SignUp(User());
            Photo photo = UserLogic.AddPhoto(user.Email, Photo(), "<encodedImageInBase64>");

            PhotoLogic.DeleteById(photo.Id);
            Assert.IsFalse(PhotoLogic.ExistsById(photo.Id));
        }