public AuthenticationApiController(UserManager <ApplicationUser> userManager,
                                    RoleManager <ApplicationIdentityRole> roleManager,
                                    IUserRoleCountryService userRoleCountryService,
                                    SignInManager <ApplicationUser> signInManager,
                                    IEmailSender emailSender,
                                    IConfiguration configuration)
 {
     _userManager            = userManager;
     _roleManager            = roleManager;
     _userRoleCountryService = userRoleCountryService;
     _signInManager          = signInManager;
     _emailSender            = emailSender;
     _configuration          = configuration;
 }
 public AccountController(
     RoleManager <ApplicationIdentityRole> roleManager,
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     IUserRoleCountryService userRoleCountryService,
     ICountryService countryService,
     IEmailSender emailSender,
     ILogger <AccountController> logger)
 {
     _roleManager            = roleManager;
     _userManager            = userManager;
     _signInManager          = signInManager;
     _userRoleCountryService = userRoleCountryService;
     _countryService         = countryService;
     _emailSender            = emailSender;
     _logger = logger;
 }
Esempio n. 3
0
 public ManageAccountController(
     UserManager <ApplicationUser> userManager,
     RoleManager <ApplicationIdentityRole> roleManager,
     ILogger <AccountController> logger,
     ILocalizationService localizationService,
     IEmailSender emailSender,
     ICountryService countryService,
     IUserRoleCountryService userRoleCountryService)
 {
     _userManager            = userManager;
     _roleManager            = roleManager;
     _logger                 = logger;
     _localizationService    = localizationService;
     _emailSender            = emailSender;
     _countryService         = countryService;
     _userRoleCountryService = userRoleCountryService;
 }
Esempio n. 4
0
        public void Init()
        {
            var services = new ServiceCollection();

            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "test_db")
                          .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking)
                          .Options;

            _memoryDbContext = new ApplicationDbContext(options);

            //Arrange
            var _localizationRepo = Substitute.For <ILocalizationRepository>();
            var _loggerRepo       = Substitute.For <ILogger <UserRoleCountryService> >();
            var _userStore        = Substitute.For <IUserStore <ApplicationUser> >();
            var _userManager      = Substitute.For <UserManager <ApplicationUser> >(_userStore, null, null, null, null, null, null, null, null);

            services.AddTransient <IUserRoleCountryRepository, UserRoleCountryRepository>();
            var serviceProvider = services.BuildServiceProvider();

            _urcRepository = new UserRoleCountryRepository(_memoryDbContext);
            _urcService    = Substitute.For <UserRoleCountryService>(_urcRepository, _localizationRepo,
                                                                     _loggerRepo, _userManager);

            _urcs = new FakeDbSet <UserRoleCountry>(
                Builder <UserRoleCountry> .CreateListOfSize(10)
                .All()
                .With(c => c.ApplicationUserId = UserId)
                .With(c => c.ID            = Guid.NewGuid())
                .With(cid => cid.CountryId = CountryId).Build());

            if (_memoryDbContext.UserRoleCountries.Count() == 0)
            {
                _memoryDbContext.UserRoleCountries.AddRange(_urcs);
                _memoryDbContext.SaveChanges();
            }
        }