Inheritance: Membrane.Commons.Plugin.DTOs.BaseDTO
        public void UpdateDetailsCanFailValidation()
        {
            var updatedUserDetails = new UserDetailsRequestDTO
                                     	{
                                     		Id = Guid.NewGuid(),
                                            Username = "******",
                                     		Name = "John Polling",
                                     		Email = string.Empty,
                                     		Password = string.Empty,
                                     		ConfirmPassword = string.Empty
                                     	};

            controller.Update(updatedUserDetails);

            Assert.IsNotNull(controller.Flash["errors"]);
            Assert.AreEqual("/UserDetails/Show.castle", Response.RedirectedTo);
        }
Example #2
0
        public bool UpdateDetails(UserDetailsRequestDTO details)
        {
            var success = true;
            try
            {
                if (details.Password != string.Empty)
                {
                    details.Password = encryptionService.Encrypt(details.Password);
                }
                var user = Mapper.Map<UserDetailsRequestDTO, MembraneUser>(details);
                user.Type = repository.FindById(user.Id).Type;
                repository.Update(user);
            }
            catch (RepositoryUpdateException)
            {
                success = false;
            }

            return success;
        }
 private void MockUserDetailsUpdate(bool success)
 {
     var updatedUserDetails = new UserDetailsRequestDTO
     {
         Id = Guid.NewGuid(),
         Username = "******",
         Name = "John Polling",
         Email = "*****@*****.**",
         Password = string.Empty,
         ConfirmPassword = string.Empty
     };
     With.Mocks(mockery)
         .Expecting(() => Expect.Call(userService.UpdateDetails(updatedUserDetails)).Return(success))
         .Verify(() => controller.Update(updatedUserDetails));
 }