예제 #1
0
        public void HomeController_BeginRegisterNoPasswordOrUsername()
        {
            HomeController homeController = new HomeController(_memeberShipService.Object);
            RegisterModel  registerModel  = new RegisterModel();

            ViewResult result = homeController.BeginRegister(registerModel) as ViewResult;

            Assert.IsNotNull(result);
            Assert.IsFalse(homeController.ModelState.IsValid);
            Assert.AreEqual("Register", result.ViewName);
        }
예제 #2
0
        public void HomeController_BeginRegisterBadMatchPasswordsAndUsername()
        {
            HomeController homeController = new HomeController(_memeberShipService.Object);
            RegisterModel  registerModel  = new RegisterModel
            {
                UserName        = "******",
                Password        = "******",
                ConfirmPassword = "******"
            };

            ViewResult result = homeController.BeginRegister(registerModel) as ViewResult;

            Assert.IsNotNull(result);
            Assert.IsFalse(homeController.ModelState.IsValid);
            Assert.AreEqual("Register", result.ViewName);
        }
예제 #3
0
        public void HomeController_BeginRegisterDuplicateUser()
        {
            _memeberShipService.Setup(s => s.IsUserRegistered(It.Is <string>(p => p == "tester"))).Returns(true);
            HomeController homeController = new HomeController(_memeberShipService.Object);

            RegisterModel registerModel = new RegisterModel
            {
                UserName        = "******",
                Password        = "******",
                ConfirmPassword = "******"
            };

            ViewResult result = homeController.BeginRegister(registerModel) as ViewResult;

            Assert.IsNotNull(result);
            Assert.IsFalse(homeController.ModelState.IsValid);
            Assert.AreEqual("Register", result.ViewName);
        }
예제 #4
0
        public void HomeController_BeginRegisterPasswordsAndUsername()
        {
            _memeberShipService.Setup(
                e => e.GenerateServerRegistration(It.Is <string>(p => p == "tester"), It.Is <string>(p => p == "password")))
            .Returns(new ServerRegisterResponse());
            HomeController homeController = new HomeController(_memeberShipService.Object);
            RegisterModel  registerModel  = new RegisterModel
            {
                UserName        = "******",
                Password        = "******",
                ConfirmPassword = "******"
            };

            ViewResult result = homeController.BeginRegister(registerModel) as ViewResult;

            Assert.IsNotNull(result);
            Assert.IsTrue(homeController.ModelState.IsValid);
            Assert.AreEqual("FinishRegister", result.ViewName);
        }