Exemplo n.º 1
0
        public void user_can_be_created()
        {
            var form = new UserForm
                           {
                               Login = "******",
                               Password = "******"
                           };

            controller.Registration(form);

            userServiceMock.Verify(s => s.Save(It.Is<User>(u =>
                u.Login == form.Login &&
                u.Password == form.Password &&
                u.IsActive == false
                )));
        }
Exemplo n.º 2
0
        public ActionResult Registration(UserForm form)
        {
            if (!ModelState.IsValid)
            {
                return View(form);
            }

            _userRepository.Save(new User
                                  {
                                      Login = form.Login,
                                      Password = form.Password,
                                      IsActive = false
                                  });

            return RedirectToAction("List", "Companies");
        }
        public void when_user_registern_it_not_active()
        {
            var form = new UserForm
            {
                Login = "******",
                Password = "******"
            };

            controller.Registration(form);

            usersMock.Verify(s => s.Save(It.Is<User>(u => u.IsActive == false )));
        }