public void ReturnErrorWhenUserNameNotUnique()
        {
            _userService.Setup(x => x.UserNameAvailable(It.IsAny<int>(), It.IsAny<string>())).Returns(false);

            var form = new RegisterForm();
            var result = _validator.Validate(form);

            Assert.False(result.IsValid);
        }
Example #2
0
        public ActionResult Register(RegisterForm form)
        {
            _registerFormValidator.Validate(form).Populate(ModelState);

            if (ModelState.IsValid)
            {
                var user = Mapper.Map<User>(form);
                _userService.Register(user);
                return RedirectToAction("RegisterComplete");
            }

            return View(form);
        }
Example #3
0
 public ActionResult Register()
 {
     var form = new RegisterForm();
     return View(form);
 }