public void RedirectToHomepageWhenNoRedirectUrlIsSet()
            {
                var oAuthConfiguration = Substitute.For<IOAuthConfiguration>();
                oAuthConfiguration.OauthTokenUrl.Returns("http://localhost/");
                var controller = new GoogleController(Substitute.For<IFormsAuthenticationService>(), oAuthConfiguration);

                var result = controller.OAuthCallback("code", "state");

                result.AssertActionRedirect().ToAction<HomeController>(c => c.Index());
            }
            public void SetANonPersistentFormsAuthenticationCookieOnSuccessfulLogin()
            {
                var formsAuthenticationService = Substitute.For<IFormsAuthenticationService>();
                var oAuthConfiguration = Substitute.For<IOAuthConfiguration>();
                oAuthConfiguration.OauthTokenUrl.Returns("http://localhost/");
                var controller = new GoogleController(formsAuthenticationService, oAuthConfiguration);

                controller.OAuthCallback("code", "state");

                formsAuthenticationService.Received().SetAuthenticationCookie("Bob", false);
            }
            public void RedirectToGivenUrlWhenARedirectUrlIsSet()
            {
                var oAuthConfiguration = Substitute.For<IOAuthConfiguration>();
                oAuthConfiguration.OauthTokenUrl.Returns("http://localhost/");
                var controller = new GoogleController(Substitute.For<IFormsAuthenticationService>(), oAuthConfiguration);

                const string redirectUrl = "/Concerts";
                var result = controller.OAuthCallback("code", "state", redirectUrl);

                result.AssertHttpRedirect().ToUrl(redirectUrl);
            }