예제 #1
0
        public void OneTimeTearDown()
        {
            // Drop the database
            _collectionManager.DropDatabase();

            // Clean up memory; send to garbage collector
            _mapper            = null;
            _config            = null;
            _connectionString  = null;
            _collectionManager = null;
        }
예제 #2
0
        public void OneTimeSetUp()
        {
            var config = new MapperConfiguration(cfg => {
                cfg.AddProfile <MongoMappingProfile>();
            });

            _mapper = config.CreateMapper();

            var environmentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
            var builder         = new ConfigurationBuilder()
                                  .AddJsonFile($"appsettings.json", true, true)
                                  .AddJsonFile($"appsettings.{environmentName}.json", true, true)
                                  .AddEnvironmentVariables();

            _config = builder.Build();

            _connectionString  = _config.GetConnectionString("NoteTakingTest");
            _collectionManager = new MongoRepositoryManager <MongoCategory, Guid>(_connectionString, "Categories");
            _collectionManager.DropDatabase();
        }