Ejemplo n.º 1
0
        public void RegisterTest()
        {//Tries to run the container code for the Register function
            var Iface = new Mock <IRegisterDatabaseContext>();

            Iface.Setup(x => x.InsertUser(It.IsAny <DataManager.Data.UserDTO>())).Returns(true);
            container.registerRepository.Context = Iface.Object;
            Assert.IsTrue(container.InsertUser(user));
        }
        public ActionResult Register(RegisterModel registerModel)
        {
            if (!ModelState.IsValid)
            {
                return(View("Register"));
            }
            RegisterContainer registerContainer = new RegisterContainer();
            UserDTO           userDTO           = new UserDTO(registerModel.FirstName, registerModel.LastName, registerModel.Email, registerModel.Password, registerModel.BirthDay);

            if (registerContainer.InsertUser(userDTO))
            {
                return(RedirectToAction("Index", "Login"));
            }
            return(View("RegisterError"));
        }