protected AdminIsBlocked() { _seeder = new T(); using var context = new WebApiContext(_seeder.DbContextOptions); _userGroup = context.GetUserGroup(); _adminGroup = context.GetAdminGroup(); _seeder.MakeAllActive(); _admin = _seeder.MakeSingleAdmin(); _admin.StateId = context.GetBlockedState().Id; context.SaveChanges(); }
protected UsersControllerTests() { _seeder = new T(); var host = Program.CreateHostBuilder(new string[] { }).Build(); _mapper = host.Services.GetRequiredService <IMapper>(); using var context = new WebApiContext(_seeder.DbContextOptions); _adminGroup = _mapper.Map <UserGroupGetDto>(context.GetAdminGroup()); _userGroup = _mapper.Map <UserGroupGetDto>(context.GetUserGroup()); _activeState = _mapper.Map <UserStateGetDto>(context.GetActiveState()); _blockedState = _mapper.Map <UserStateGetDto>(context.GetBlockedState()); _seeder.MakeAllActive(); }