protected override void Act() { _clientCredentialsTokenRequestHandler = new ClientCredentialsTokenRequestProvider(_clientAppRepo, _apiClientAuthenticator); _actionResult = _clientCredentialsTokenRequestHandler.HandleAsync(_tokenRequest).Result; }
protected override void Act() { _clientCredentialsTokenRequestProvider = new ClientCredentialsTokenRequestProvider(_apiClientAuthenticator, _accessTokenClientRepo); _actionResult = _clientCredentialsTokenRequestProvider.HandleAsync(_tokenRequest).GetResultSafely(); }
public static TokenController CreateTokenController( IClientAppRepo clientAppRepo, IApiClientAuthenticator apiClientAuthenticator, IAccessTokenClientRepo accessTokenClientRepo) { var tokenRequestProvider = new ClientCredentialsTokenRequestProvider(clientAppRepo, apiClientAuthenticator, accessTokenClientRepo); var controller = new TokenController(tokenRequestProvider); var request = A.Fake <HttpRequest>(); request.Method = "Post"; request.Scheme = "http"; A.CallTo(() => request.Host).Returns(new HostString("localhost", 80)); request.PathBase = "/"; request.RouteValues = new RouteValueDictionary { { "controller", "authorize" } }; var httpContext = A.Fake <HttpContext>(); A.CallTo(() => httpContext.Request).Returns(request); var controllerContext = new ControllerContext() { HttpContext = httpContext, }; var routeData = A.Fake <RouteData>(); RouteValueDictionary dictionary = new RouteValueDictionary { { "controller", "authorize" } }; controllerContext.RouteData = new RouteData(dictionary); controller.ControllerContext = controllerContext; return(controller); }