Exemple #1
0
        public void TestChangeVerifyCodePost_NoUser()
        {
            string testUrl = "/lskfj";

            IRpcBroker broker = MockRpcBrokerFactory.GetChangeVerifyCodePostBroker(true, false);

            AccountController controller = new AccountController(broker);

            ChangeVerifyCode cvc = new ChangeVerifyCode()
            {
                OriginalVerifyCode = "",
                NewVerifyCode      = "",
                ConfirmVerifyCode  = "",
                RequestedUrl       = testUrl
            };

            int    timeout        = 0;
            string authorizedUser = "";

            ActionResult result = controller.ProcessChangeVerifyCodePost(cvc, true, true, out timeout, out authorizedUser);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult));
            RedirectToRouteResult routeResult = (RedirectToRouteResult)result;

            Assert.AreEqual("Home", routeResult.RouteValues["controller"]);
            Assert.AreEqual("Index", routeResult.RouteValues["action"]);
            Assert.IsTrue(timeout > 0);
            Assert.IsTrue(string.IsNullOrWhiteSpace(authorizedUser));
        }
Exemple #2
0
        public void TestChangeVerifyCodePost_FailedChange()
        {
            string testUrl = "/lskfj";

            IRpcBroker broker = MockRpcBrokerFactory.GetChangeVerifyCodePostBroker(false);

            AccountController controller = new AccountController(broker);

            ChangeVerifyCode cvc = new ChangeVerifyCode()
            {
                OriginalVerifyCode = "",
                NewVerifyCode      = "",
                ConfirmVerifyCode  = "",
                RequestedUrl       = testUrl
            };

            int    timeout        = 0;
            string authorizedUser = "";

            ActionResult result = controller.ProcessChangeVerifyCodePost(cvc, true, false, out timeout, out authorizedUser);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(ViewResult));
            ViewResult viewResult = (ViewResult)result;

            Assert.IsInstanceOfType(viewResult.Model, typeof(ChangeVerifyCode));
        }