public static void InitializeDbForTests(JoggingTrackerDataContext db, UserManager <UserDb> userManager, RoleManager <IdentityRole> roleManager) { foreach (var roleName in UserRoles.AllRoles) { IdentityRole role = new IdentityRole { Name = roleName, NormalizedName = roleName }; roleManager.CreateAsync(role).Wait(); } foreach (var userDb in SeedUsers) { userManager.CreateAsync(userDb, UserPassword).Wait(); } userManager.AddToRoleAsync(SeedUsers[0], UserRoles.Admin).Wait(); userManager.AddToRoleAsync(SeedUsers[1], UserRoles.UserManager).Wait(); userManager.AddToRoleAsync(SeedUsers[2], UserRoles.RegularUser).Wait(); db.Runs.AddRange(SeedRegularUserRuns); db.SaveChanges(); }
public RunService(JoggingTrackerDataContext dbContext, IWeatherService weatherService, IMapper mapper) { _dbContext = dbContext; _weatherService = weatherService; _mapper = mapper; }
public TestUserSevice(UserManager <UserDb> userManager, SignInManager <UserDb> signInManager, JoggingTrackerDataContext dbContext, RoleManager <IdentityRole> roleManager, ITokenService tokenService, IMapper mapper) : base(userManager, signInManager, dbContext, roleManager, tokenService, mapper) { }
public UserService(UserManager <UserDb> userManager, SignInManager <UserDb> signInManager, JoggingTrackerDataContext dbContext, RoleManager <IdentityRole> roleManager, ITokenService tokenService, IMapper mapper) { _userManager = userManager; _signInManager = signInManager; _dbContext = dbContext; _roleManager = roleManager; _tokenService = tokenService; _mapper = mapper; }
public TestRunService(JoggingTrackerDataContext dbContext, IWeatherService weatherService, IMapper mapper) : base(dbContext, weatherService, mapper) { }
public BaseIntegrationTest(CustomWebApplicationFactory <Startup> factory) { _client = factory.CreateClient(); _dbContext = new JoggingTrackerDataContext(FakeDbUtilities.GetDbContextOptions()); }