public void SetConfigSavesDataToCache() { // Arrange const string newCacheData = "SomeData"; var newCacheItemKey = Guid.NewGuid().ToString(); // Act configCacheProvider.SetConfig(newCacheItemKey, newCacheData); // Assert var cacheResult = JsonConvert.DeserializeObject(configCacheProvider.GetConfig(newCacheItemKey)); Assert.Equal(newCacheData, cacheResult); var cacheResultForDefaultValue = configCacheProvider.GetConfig(SimpleObjectKey); Assert.True(!string.IsNullOrEmpty(cacheResultForDefaultValue)); }
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); }