示例#1
0
        public void GetConfigReturnsEmptyStringWhenKeyNotFound()
        {
            // Act
            var result = configCacheProvider.GetConfig("UnknownKey");

            // Assert
            Assert.True(string.IsNullOrEmpty(result));
        }
示例#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);
        }