public void UpdateExistentDefaultConfigStoreWithValueUpdates()
        {
            try
            {
                var newConfigStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                newConfigStore.SettingsShouldBeInitialized();

                newConfigStore.Properties["Key1"] = "Value1";
                newConfigStore.Properties["Key2"] = "Value2";
                newConfigStore.Save();

                var existentConfigStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                existentConfigStore.Properties.Should().BeEquivalentTo(newConfigStore.Properties);
                existentConfigStore.Properties["Key1"] = "Value3";
                existentConfigStore.Properties["Key2"] = "Value4";
                existentConfigStore.Save();

                var reloadConfigStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                reloadConfigStore.Properties.Should().NotContainValues("Value1", "Value2");
                reloadConfigStore.Properties.Should().BeEquivalentTo(existentConfigStore.Properties);
            }
            finally
            {
                var configStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                configStore.Delete();
            }
        }
        public void DeleteNonexistentDefaultConfigStoreDoesNotThrow()
        {
            var    configStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
            Action act         = () => configStore.Delete();

            act.Should().NotThrow();
        }
        public void DeleteNonexistentNonDefaultConfigStoreThrows()
        {
            var configStore = new ConfigStore(_affiliateApplication.Name, Guid.NewGuid().ToString("B"));

            Action(() => configStore.Delete())
            .Should().Throw <InvalidOperationException>()
            .WithMessage("Cannot delete a ConfigStore other than the default one.");
        }
        public void DeleteExistentDefaultConfigStoreDoesNotThrow()
        {
            var configStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);

            configStore.SettingsShouldBeInitialized();
            configStore.Properties["Key1"] = "Value1";
            configStore.Save();
            Action(() => configStore.Delete()).Should().NotThrow();
        }
Exemple #5
0
        public void DeleteExistentDefaultConfigStoreDoesNotThrow()
        {
            var configStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);

            configStore.Properties.Count.Should().Be(0);
            configStore.Properties["Key1"] = "Value1";
            configStore.Save();
            Invoking(() => configStore.Delete()).Should().NotThrow();
        }
Exemple #6
0
        public void SaveAndLoadEmptyDefaultConfigStore()
        {
            try
            {
                var configStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                configStore.Properties.Should().BeEmpty();
                configStore.Save();

                configStore = new(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                Invoking(() => configStore.Properties).Should().NotThrow();
            }
            finally
            {
                var configStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                configStore.Delete();
            }
        }
        public void PropertyNameIsCaseInsensitive()
        {
            try
            {
                var configStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                configStore.SettingsShouldBeInitialized();

                configStore.Properties["PropertyNameWithCasing"] = "Value1";
                configStore.Save();

                configStore.Properties["propertynamewithcasing"].Should().Be("Value1");
            }
            finally
            {
                var configStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                configStore.Delete();
            }
        }
        public void SaveNonexistentDefaultConfigStore()
        {
            try
            {
                var configStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                configStore.SettingsShouldBeInitialized();

                configStore.Properties["Key1"] = "Value1";
                configStore.Properties["Key2"] = "Value2";
                configStore.Save();

                var reloadConfigStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                reloadConfigStore.Properties.Should().BeEquivalentTo(configStore.Properties);
            }
            finally
            {
                var configStore = new ConfigStore(_affiliateApplication.Name, ConfigStoreCollection.DEFAULT_CONFIG_STORE_IDENTIFIER);
                configStore.Delete();
            }
        }