public LimitsMongoDbPersistenceTest()
        {
            var mongoUri      = Environment.GetEnvironmentVariable("MONGO_SERVICE_URI");
            var mongoHost     = Environment.GetEnvironmentVariable("MONGO_SERVICE_HOST") ?? "localhost";
            var mongoPort     = Environment.GetEnvironmentVariable("MONGO_SERVICE_PORT") ?? "27017";
            var mongoDatabase = Environment.GetEnvironmentVariable("MONGO_SERVICE_DB") ?? "test";

            // Exit if mongo connection is not set
            if (mongoUri == null && mongoHost == null)
            {
                return;
            }

            ConfigParams config = ConfigParams.FromTuples(
                "connection.uri", mongoUri,
                "connection.host", mongoHost,
                "connection.port", mongoPort,
                "connection.database", mongoDatabase
                );

            Persistence = new LimitsMongoDbPersistence();
            Persistence.Configure(config);
            Persistence.OpenAsync(null).Wait();
            Persistence.ClearAsync(null).Wait();
            Fixture = new LimitsPersistenceFixture(Persistence);
        }
コード例 #2
0
        public LimitsFilePersistenceTest()
        {
            Persistence = new LimitsFilePersistence();
            var config = new ConfigParams();

            config.Add("path", "./Data/beacons.test.json");
            Persistence.Configure(config);
            Fixture = new LimitsPersistenceFixture(Persistence);
        }
 public LimitsMemoryPersistenceTest()
 {
     Persistence = new LimitsMemoryPersistence();
     Fixture     = new LimitsPersistenceFixture(Persistence);
 }