Esempio n. 1
0
            public void SetFixture(MockRepository mocks)
            {
                mockRepository        = mocks;
                DefaultProvider       = mocks.DynamicMock <IOAuthProvider>();
                DefaultcontextBuilder = mocks.DynamicMock <IOAuthContextBuilder>();
                var httpRequest     = mocks.DynamicMock <HttpRequestBase>();
                var httpContextMock = mocks.DynamicMock <HttpContextBase>();

                mockOAuthContext = mocks.DynamicMock <IOAuthContext>();
                DefaultcontextBuilder.Stub(contextBuilder => contextBuilder.FromHttpRequest(httpRequest)).Return(mockOAuthContext);
                DefaultProvider.Stub(provider => provider.ExchangeRequestTokenForAccessToken(mockOAuthContext)).Return(requestToken);
                httpContextMock.Stub(httpcontext => httpcontext.Request).Return(httpRequest);
                var controller        = new OAuthController(ContextBuilder, Provider);
                var controllerContext = new ControllerContext(httpContextMock, new RouteData(), controller);

                controller.ControllerContext = controllerContext;
                mocks.ReplayAll();
                result = controller.AccessToken();
            }