Example #1
0
        public InMemorySharedConfigCacheProviderTests()
        {
            var defaultCacheValues = GetDefaultCacheValues();

            settings = new SharedConfigSettings
            {
                ConfigurationStorageConnectionString = "DummyConnectionString",
                InMemoryCacheTimeToLiveTimeSpan      = "00:01:00",
                CloudStorageTableName = "CloudTableName",
                EnvironmentName       = "Develop"
            };

            configCacheProvider = new InMemorySharedConfigCacheProvider(settings, defaultCacheValues);
        }
Example #2
0
        public void SetConfigSavesDataToCacheWithoutDefaultValues()
        {
            // Arrange
            const string newCacheData    = "OnlyItemOfData";
            var          newCacheItemKey = Guid.NewGuid().ToString();
            var          cacheProvider   = new InMemorySharedConfigCacheProvider(settings);

            // Act
            cacheProvider.SetConfig(newCacheItemKey, newCacheData);

            // Assert
            var cacheResult = JsonConvert.DeserializeObject(cacheProvider.GetConfig(newCacheItemKey));

            Assert.Equal(newCacheData, cacheResult);

            var cacheResultForDefaultValue = JsonConvert.DeserializeObject(cacheProvider.GetConfig(SingleValueKey));

            Assert.Null(cacheResultForDefaultValue);
        }