public void Validate_Successful_With_Valid_Information()
        {
            // Arrange
            var model = new SignUpInputModel
            {
                Email = "*****@*****.**",
                Password = "******",
                ConfirmPassword = "******"
            };
            var validationDictionary = new ValidationDictionary();

            // Act

            var result = model.ValidateRequest(validationDictionary);

            // Assert
            Assert.IsTrue(result);
        }
        public void Validate_Fails_Mismatched_Passwords()
        {
            // Arrange
            var model = new SignUpInputModel
                {
                    Email = "*****@*****.**",
                    Password = "******",
                    ConfirmPassword = "******"
                };
            var validationDictionary = new ValidationDictionary();

            // Act

            var result = model.ValidateRequest(validationDictionary);

            // Assert
            Assert.IsFalse(result);
        }
        public BaseResponseModel SignUp(SignUpInputModel inputModel)
        {
            var vm = new AuthResponseModel();

            // Validate request
            var validationState = new ValidationDictionary();
            inputModel.ValidateRequest(validationState);

            var user = new User
                {
                    Email = inputModel.Email,
                    Role = Role.Member
                };
            UserService.GenerateUserPassword(user, inputModel.Password);

            if (UserService.ValidateUser(user, validationState))
            {
                UserService.CreateUser(user);

                // Authenticate to create token
                user = UserService.Authenticate(user.Email, inputModel.Password);
                _auth.DoAuth(user.Email, false);

                vm.Success = true;
                vm.Token = user.AuthToken.Token;
                vm.Expires = user.AuthToken.Expires;
            }

            vm.Errors = validationState.Errors;
            return vm;
        }