protected virtual async Task <IConfigurationManipulator> GetConfigurationManipulator()
        {
            var manipulator = new ConfigurationManipulator();

            manipulator.EnvironmentId    = EnvironmentId;
            manipulator.ConnectionString = this.Configuration.GetConnectionString("DatabaseEndpoint");
            manipulator.DatabaseName     = Configuration["appSettings:configurationDatabase"];
            return(await manipulator.Initialize());
        }
Esempio n. 2
0
        public async Task TestConfigCreateAndUpdate()
        {
            var confAccessor = new ConfigurationManipulator();

            confAccessor.ConnectionString   = "mongodb://localhost:27017";
            confAccessor.DatabaseName       = "localconfiguration";
            confAccessor.SettingsCollection = "settings";

            await confAccessor.Initialize();

            var conf = await confAccessor.GetEntry(null, "test");

            if (conf != null)
            {
                await confAccessor.EnsureForEntry(null, "test", "test value", Configuration.ConfigurationValueMeaning.String, "Test", true);
            }
            var newVal = "Updated string value " + DateTime.Now.ToString("u");

            conf = await confAccessor.EnsureForEntry(null, "test", newVal);

            Assert.AreEqual(newVal, conf.Value.StringValue, "String value does not match");
        }