private void InitAccount(User user) { _currentUser = user; _accountController = new accountController(); _accountList = new List <Account>(); this.lblUser.Text = "用户:" + user.UserName; SetAccountInfo(user); }
public void Setup() { _emailGenerator = new MockEmailGenerator(); _serviceProvider = ConfigurationHelper.CreateServiceProvider(); _controller = new accountController( _serviceProvider.GetService <ApplicationSignInManager <ApplicationUser> >(), _serviceProvider.GetService <ILogger <accountController> >(), _emailGenerator, new WebSiteOptions()); _controller.ControllerContext = new Microsoft.AspNetCore.Mvc.ControllerContext(); _controller.ControllerContext.HttpContext = _serviceProvider.GetService <IHttpContextAccessor>().HttpContext; _controller.Url = new NullUrlHelper(); }