/// <summary>
        /// Sets up all needed repositories and purges all related tables.
        /// </summary>
        public MaterialBatchRepositoryTests()
        {
            IConfiguration configuration = ConfigurationProvider.GetConfiguration();

            Repository          = new PostgreSqlMaterialBatchRepository(configuration);
            LocationsRepository = new PostgreSqlLocationsRepository(configuration);
            MaterialsRepository = new PostgreSqlMaterialsRepository(configuration);
            PlasticsRepository  = new PostgreSqlPlasticsRepository(configuration);
            PropRepository      = new PostgreSqlCustomBatchPropRepository(configuration);
            Dispose();
        }
示例#2
0
        /// <summary>
        /// Sets up all needed repositories and purges all related DB tables.
        /// </summary>
        public TransactionRepositoryTests()
        {
            IConfiguration configuration = ConfigurationProvider.GetConfiguration();

            Repository          = new PostgreSqlTransactionRepository(configuration);
            BatchRepository     = new PostgreSqlMaterialBatchRepository(configuration);
            LocationsRepository = new PostgreSqlLocationsRepository(configuration);
            MaterialsRepository = new PostgreSqlMaterialsRepository(configuration);
            PlasticsRepository  = new PostgreSqlPlasticsRepository(configuration);
            UserRepository      = new PostgreSqlUserRepository(configuration);
            Dispose();
        }
示例#3
0
        /// <summary>
        /// Sets up needed repositories and purges all related tables.
        /// </summary>
        public MaterialsRepositoryTests()
        {
            // Repos
            IConfiguration configuration = ConfigurationProvider.GetConfiguration();

            Repository          = new PostgreSqlMaterialsRepository(configuration);
            PropRepository      = new PostgreSqlCustomMaterialPropRepository(configuration);
            PropValueRepository = new PostgreSqlCustomMaterialPropValueRepository(configuration);
            IPlasticsRepository plasticsRepository = new PostgreSqlPlasticsRepository(configuration);

            // Purge for blank slate
            DatabasePurger.PurgeMaterials();
            DatabasePurger.PurgePlastics();
            DatabasePurger.PurgeCustomMaterialProps();

            // Create plastics
            PC = plasticsRepository.CreatePlastic("PC", "Polycarbonate");
            PE = plasticsRepository.CreatePlastic("PE", "Polyethylene");
        }
示例#4
0
 /// <summary>
 /// Sets up the SUT and needed services and and cleans up plastics tbales.
 /// </summary>
 public PlasticsRepositoryTests()
 {
     Repository = new PostgreSqlPlasticsRepository(ConfigurationProvider.GetConfiguration());
     DatabasePurger.PurgePlastics();
 }
 /// <summary>
 /// Sets up the SUT and needed services, and cleans up the users table.
 /// </summary>
 public UserRepositoryTests()
 {
     Repository             = new PostgreSqlUserRepository(ConfigurationProvider.GetConfiguration());
     PasswordHashingService = new PasswordHashingService(new LoggerFactory());
     DatabasePurger.PurgeUsers();
 }
示例#6
0
 /// <summary>
 /// Sets up all needed repositories and purges related tables.
 /// </summary>
 public CustomBatchPropRepositoryTests()
 {
     Repository = new PostgreSqlCustomBatchPropRepository(ConfigurationProvider.GetConfiguration());
     DatabasePurger.PurgeCustomBatchProps();
 }
示例#7
0
 /// <summary>
 /// Sets up the SUT and needed services and and cleans up API key tbales.
 /// </summary>
 public ApiKeyRepositoryTests()
 {
     Repository    = new PostgreSqlApiKeyRepository(ConfigurationProvider.GetConfiguration());
     RightsService = new RightsService(new LoggerFactory(), new MemoryRightsRepository());
     DatabasePurger.PurgeApiKeys();
 }
 /// <summary>
 /// Sets up the SUT and needed services and and cleans up locations tbales.
 /// </summary>
 public LocationsRepositoryTests()
 {
     Repository = new PostgreSqlLocationsRepository(ConfigurationProvider.GetConfiguration());
     DatabasePurger.PurgeLocations();
 }
示例#9
0
 /// <summary>
 /// Gets the dataabase connection string from configuration.
 /// </summary>
 /// <returns>Returns the connection string.</returns>
 private static string GetConnectionString()
 {
     return(ConfigurationProvider.GetConfiguration().GetValue <string>("Database:ConnectionString"));
 }
示例#10
0
 /// <summary>
 /// Sets up the SUT and resets configuration.
 /// </summary>
 public ConfigurationRepositoryTests()
 {
     Repository = new PostgreSqlConfigurationRepository(ConfigurationProvider.GetConfiguration());
     DatabasePurger.ResetConfiguration();
 }