Beispiel #1
0
        public static User ReloadUser <TEntryPoint>(NhipsterWebApplicationFactory <TEntryPoint> factory, User user)
            where TEntryPoint : class
        {
            var applicationDatabaseContext = factory.GetRequiredService <ApplicationDatabaseContext>();

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

            _userManager    = _factory.GetRequiredService <UserManager <User> >();
            _passwordHasher = _factory.GetRequiredService <IPasswordHasher <User> >();
        }
        public CountryResourceIntTest()
        {
            _factory = new NhipsterWebApplicationFactory <TestStartup>().WithMockUser();
            _client  = _factory.CreateClient();

            _applicationDatabaseContext = _factory.GetRequiredService <ApplicationDatabaseContext>();

            InitTest();
        }
        public BankAccountResourceIntTest()
        {
            _factory = new NhipsterWebApplicationFactory <Startup>();
            _client  = _factory.CreateClient();

            _applicationDatabaseContext = _factory.GetRequiredService <ApplicationDatabaseContext>();

            InitTest();
        }
        public UserResourceIntTest()
        {
            _factory = new NhipsterWebApplicationFactory <Startup>();
            _client  = _factory.CreateClient();

            _userManager    = _factory.GetRequiredService <UserManager <User> >();
            _userMapper     = _factory.GetRequiredService <UserMapper>();
            _passwordHasher = _userManager.PasswordHasher;

            InitTest();
        }
Beispiel #6
0
        public AccountResourceIntTest()
        {
            _factory = new NhipsterWebApplicationFactory <TestStartup>();
//            _factory.WithWebHostBuilder(builder => {
//                var mockMailService = A.Fake<IMailService>();
//                A.CallTo(() => mockMailService.SendActivationEmail(A<User>.Ignored)).Returns(Task.CompletedTask);
//                builder.ConfigureServices(services => {
//                    services.Replace(new ServiceDescriptor(typeof(IMailService), sp => mockMailService,
//                        ServiceLifetime.Scoped));
//                });
//            });
        }
Beispiel #7
0
        public UserResourceIntTest()
        {
            _factory = new NhipsterWebApplicationFactory <TestStartup>().WithMockUser("test", new HashSet <string> {
                RolesConstants.ADMIN
            });
            _client = _factory.CreateClient();

            _userManager    = _factory.GetRequiredService <UserManager <User> >();
            _userMapper     = _factory.GetRequiredService <UserMapper>();
            _passwordHasher = _userManager.PasswordHasher;

            InitTest();
        }
Beispiel #8
0
        public SazemanResourceIntTest()
        {
            _factory = new NhipsterWebApplicationFactory <TestStartup>().WithMockUser();
            _client  = _factory.CreateClient();

            _sazemanRepository = _factory.GetRequiredService <ISazemanRepository>();

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

            _mapper = config.CreateMapper();

            InitTest();
        }
Beispiel #9
0
        public UserResourceIntTest()
        {
            _factory = new NhipsterWebApplicationFactory <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();
        }
Beispiel #10
0
 public ProfileInfoControllerIntTest()
 {
     _factory = new NhipsterWebApplicationFactory <TestStartup>();
 }
 public AccountResourceIntTest()
 {
     _factory = new NhipsterWebApplicationFactory <TestStartup>();
 }
Beispiel #12
0
 public ExtendedServiceRegistrationTest()
 {
     _factory           = new NhipsterWebApplicationFactory <TestStartup>().WithMockUser();
     _countryService    = _factory.GetRequiredService <ICountryService>();
     _departmentService = _factory.GetRequiredService <IDepartmentService>();
 }