public void TestLogOff()
        {
            var accountController = new AccountController();
            RedirectToRouteResult redirectToRouteResult;

            //Scope the detours we're creating
            using (ShimsContext.Create())
            {
                //Detours FormsAuthentication.SignOut() to an empty implementation
                ShimFormsAuthentication.SignOut = () => { };
                redirectToRouteResult = accountController.LogOff() as RedirectToRouteResult;
            }

            Assert.IsNotNull(redirectToRouteResult);
            Assert.AreEqual("Index", redirectToRouteResult.RouteValues["Action"]);
            Assert.AreEqual("Home", redirectToRouteResult.RouteValues["controller"]);
        }
        public void TestJsonLogin()
        {
            const string testUserName = "******";
            const string testPassword = "******";
            const bool testRememberMe = false;
            const string testUrl = "TestUrl";

            var loginModel = new LoginModel
            {
                Password = testPassword,
                RememberMe = testRememberMe,
                UserName = testUserName
            };

            var controller = new AccountController();
            JsonResult jsonResult;

            using (ShimsContext.Create())
            {
                ShimMembership.ValidateUserStringString = (userName, password) =>
                {
                    Assert.AreEqual(testUserName, userName);
                    Assert.AreEqual(testPassword, password);
                    return true;
                };

                //Sets up a detour for FormsAuthentication.SetAuthCookie to our mocked implementation
                ShimFormsAuthentication.SetAuthCookieStringBoolean = (userName, rememberMe) =>
                {
                    Assert.AreEqual(testUserName, userName);
                    Assert.AreEqual(testRememberMe, rememberMe);
                };

                jsonResult = controller.JsonLogin(loginModel, testUrl);
                dynamic data = jsonResult.Data;
                Assert.AreEqual(true, data.success);
                Assert.AreEqual(testUrl, data.redirect);
            }
        }