public void GetValue_NotExistingInCache_ReturnDefaultValue() { var configurationReader = new ConfigurationEngine(_dataRepository, _mockCacheRepository, ApplicationName, 1); _mockCacheRepository.Get <List <CacheConfigurationDTO> >(Arg.Any <string>()).Returns( new List <CacheConfigurationDTO> { new CacheConfigurationDTO { Name = "name", ApplicationName = ApplicationName, Value = "test", Type = "String" } }); var result = configurationReader.GetValue <string>("name2"); Assert.AreEqual(result, default(string)); }
public void GetValue_ExistingInCache_ReturnValue() { var keyValue = "value"; var configurationReader = new ConfigurationEngine(_dataRepository, _mockCacheRepository, ApplicationName, 1); _mockCacheRepository.Get <List <CacheConfigurationDTO> >(Arg.Any <string>()).Returns( new List <CacheConfigurationDTO> { new CacheConfigurationDTO { Name = "name", ApplicationName = ApplicationName, Value = keyValue, Type = "String", IsActive = true } }); var result = configurationReader.GetValue <string>("name"); Assert.AreEqual(result, keyValue); }