public override void setupContext()
        {
            httpContext = new Mock<HttpContextBase>();
            formsAuthenticationServiceMock = new Mock<IFormsAuthenticationService>();
            membershipService = new Mock<IMembershipService>();

            httpRequest = new Mock<HttpRequestBase>();
            httpRequest.Setup(hr => hr.Url).Returns(new Uri("http://mysite.example.com/"));

            httpContext.Setup(hc => hc.User).Returns(new GenericPrincipal(new GenericIdentity(username), null));
            httpContext.Setup(hc => hc.Request).Returns(httpRequest.Object);

            var requestContext = new RequestContext(httpContext.Object, new RouteData());
            sut = new AccountController(formsAuthenticationServiceMock.Object, membershipService.Object)
                      {
                          Url = new UrlHelper(requestContext)
                      };

            sut.ControllerContext = new ControllerContext()
                                        {
                                            Controller = sut,
                                            RequestContext = requestContext
                                        };
        }
        private static AccountController GetAccountController()
        {
            var formsAuthenticationServiceMock = new Mock<IFormsAuthenticationService>();
            var membershipSeviceMock = new Mock<IMembershipService>();

            var requestContext = new RequestContext(new MockHttpContext(), new RouteData());
            var controller = new AccountController(formsAuthenticationServiceMock.Object, membershipSeviceMock.Object)
                                 {
                                     Url = new UrlHelper(requestContext)
                                 };

            controller.ControllerContext = new ControllerContext()
                                               {
                                                   Controller = controller,
                                                   RequestContext = requestContext
                                               };
            return controller;
        }