Beispiel #1
0
        public async void HttpGet_SignIn_IsNotSignedIn_ShouldReturnLoginView()
        {
            A.CallTo(() => weeeAuthorization.GetAuthorizationState())
            .Returns(AuthorizationState.NotLoggedIn());

            var controller = AccountController();
            var result     = await controller.SignIn("AnyUrl");

            var viewResult = ((ViewResult)result);

            Assert.Equal("SignIn", viewResult.ViewName);
        }
Beispiel #2
0
        public async void HttpGet_ErrorRedirect_UserIsNotLoggedIn_RedirectsToExternalSignIn()
        {
            A.CallTo(() => weeeAuthorization.GetAuthorizationState())
            .Returns(AuthorizationState.NotLoggedIn());

            var result = await ErrorsController().ErrorRedirect();

            Assert.IsType <RedirectToRouteResult>(result);

            var routeValues = ((RedirectToRouteResult)result).RouteValues;

            Assert.Equal("Account", routeValues["controller"]);
            Assert.Equal("SignIn", routeValues["action"]);
            Assert.Equal(string.Empty, routeValues["area"]);
        }