コード例 #1
0
 private void InitAccount(User user)
 {
     _currentUser       = user;
     _accountController = new accountController();
     _accountList       = new List <Account>();
     this.lblUser.Text  = "用户:" + user.UserName;
     SetAccountInfo(user);
 }
コード例 #2
0
        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();
        }