Exemplo n.º 1
0
 public IActionResult DeleteTag(Guid id, Guid tagId)
 {
     try
     {
         return(Ok(PhotoModel.ToModel(Photos.DeleteTag(id, tagId))));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
        public void DeleteTag()
        {
            List <string> tags = new List <string>();

            tags.Add("Cat");
            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(tags);

            User  user          = SessionLogic.SignUp(User());
            Photo photoToUpdate = UserLogic.AddPhoto(user.Email, Photo(), "<encodedImageInBase64>");
            Photo updatedPhoto  = PhotoLogic.DeleteTag(photoToUpdate.Id, photoToUpdate.Tags[0].Id);

            Assert.IsTrue(updatedPhoto.Tags.Count == 0);
        }