public void CreateAlbum() { List <string> tags = new List <string>(); tags.Add("Cat"); tags.Add("Feline"); List <Tag> tagsList = new List <Tag>(); tagsList.Add(Tag.ByName("Cat")); tagsList.Add(Tag.ByName("Feline")); 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 photo = UserLogic.AddPhoto(user.Email, Photo(), "<encodedImageInBase64>"); Album generatedAlbum = AlbumLogic.CreateAlbumByTags(User().Email, "Cats", tagsList); Assert.IsTrue(generatedAlbum.Photos().Contains(photo)); }
public void Update() { User user = SessionLogic.SignUp(User()); User modifiedUser = new User() { Password = "******", PasswordConfirmation = "newpassword456", Name = "Paul", BornDate = Convert.ToDateTime("1995, 8, 13"), Phone = "094376153" }; User updatedUser = UserLogic.Update(user.Email, modifiedUser); Assert.IsTrue(updatedUser.Name.Equals("Paul") && updatedUser.BornDate.Equals(Convert.ToDateTime("1995, 8, 13")) && updatedUser.Phone.Equals("094376153")); }
public IActionResult PostSignUp([FromBody] UserModel userFromRequest) { try { var user = UserModel.ToModel(Sessions.SignUp(UserModel.ToEntity(userFromRequest))); return(Ok(user)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public void SearchByTags() { List <string> tags = new List <string>(); tags.Add("Cat"); tags.Add("Feline"); List <Tag> tagsList = new List <Tag>(); tagsList.Add(Tag.ByName("Cat")); tagsList.Add(Tag.ByName("Feline")); 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 photo = UserLogic.AddPhoto(user.Email, Photo(), "<encodedImageInBase64>"); List <Photo> returnedPhotos = PhotoLogic.SearchByTags(user.Email, tagsList); Assert.AreEqual(returnedPhotos[0], photo); }
public void SignUp() { User user = SessionLogic.SignUp(User()); Assert.IsTrue(UserLogic.Exists(user.Id)); }