public void InvokesUserRepository()
        {
            var user = new User {};

            var handler = new CreateUser(_userRepo.Object);
            handler.Execute("id");

            _userRepo
                .Verify(r => r.Create(It.Is<User>(u => u.AuthorizationId == "id")), Times.Once());
        }
 public AuthController(
     IOpenIdRelyingParty relyingParty, 
     IFormsAuthentication formsAuthentication,
     CreateUser createUser,
     GetUserByClaimId getUserByClaimId)
 {
     _relyingParty = relyingParty;
     _formsAuthentication = formsAuthentication;
     _createUser = createUser;
     _getUserByClaimId = getUserByClaimId;
 }
 public TestableAuthController(IOpenIdRelyingParty mockRelyingParty, IFormsAuthentication formsAuth,
                               CreateUser createUser, GetUserByClaimId getUser)
     : base(mockRelyingParty, formsAuth, createUser, getUser)
 {
 }
        private static TestableAuthController GetTestableAuthController(
            IOpenIdRelyingParty relyingParty,
            IFormsAuthentication formsAuth,
            CreateUser createUser,
            GetUserByClaimId getUser,
            string providerUrl = @"http:\\testprovider.com")
        {
            HttpContextBase contextMock = MvcMockHelpers.FakeHttpContext(providerUrl);
            var authController = new TestableAuthController(relyingParty, formsAuth, createUser, getUser);
            authController.ControllerContext = new ControllerContext(contextMock, new RouteData(), authController);
            authController.InvokeInitialize(authController.ControllerContext.RequestContext);

            // default routes
            var routes = new RouteCollection();
            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new {controller = "Home", action = "Index", id = ""} // Parameter defaults
                );
            authController.Url = new UrlHelper(authController.ControllerContext.RequestContext,
                                               routes);

            return authController;
        }