Beispiel #1
0
        public UserJwtControllerIntTest()
        {
            _factory = new AppWebApplicationFactory <TestStartup>();
            _client  = _factory.CreateClient();

            _userManager    = _factory.GetRequiredService <UserManager <User> >();
            _passwordHasher = _factory.GetRequiredService <IPasswordHasher <User> >();
        }
        public static User ReloadUser <TEntryPoint>(AppWebApplicationFactory <TEntryPoint> factory, User user)
            where TEntryPoint : class
        {
            var applicationDatabaseContext = factory.GetRequiredService <ApplicationDatabaseContext>();

            applicationDatabaseContext.Entry(user).Reload();
            return(user);
        }
        public EmployeesControllerIntTest()
        {
            _factory = new AppWebApplicationFactory <TestStartup>().WithMockUser();
            _client  = _factory.CreateClient();

            _employeeRepository = _factory.GetRequiredService <IEmployeeRepository>();


            InitTest();
        }
        public ProdutoResourceIntTest()
        {
            _factory = new AppWebApplicationFactory <TestStartup>().WithMockUser();
            _client  = _factory.CreateClient();

            _produtoRepository = _factory.GetRequiredService <IProdutoRepository>();


            InitTest();
        }
Beispiel #5
0
        public DepartmentResourceIntTest()
        {
            _factory = new AppWebApplicationFactory <TestStartup>().WithMockUser();
            _client  = _factory.CreateClient();

            _departmentRepository = _factory.GetRequiredService <IDepartmentRepository>();

            var config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(new AutoMapperProfile());
            });

            _mapper = config.CreateMapper();

            InitTest();
        }
Beispiel #6
0
        public UserResourceIntTest()
        {
            _factory = new AppWebApplicationFactory <TestStartup>().WithMockUser("test", new HashSet <string> {
                RolesConstants.ADMIN
            });
            _client         = _factory.CreateClient();
            _userManager    = _factory.GetRequiredService <UserManager <User> >();
            _passwordHasher = _userManager.PasswordHasher;

            var config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(new AutoMapperProfile());
            });

            _mapper = config.CreateMapper();

            InitTest();
        }
 public AccountResourceIntTest()
 {
     _factory = new AppWebApplicationFactory <TestStartup>();
 }
Beispiel #8
0
 public ProfileInfoControllerIntTest()
 {
     _factory = new AppWebApplicationFactory <TestStartup>();
 }