public void GetEcConfigConfigurations_ReturnCacheConfigs() { MemoryCache.Default.Add(EcConfigResources.CacheKey_EcConfigs, new EcGlobalConfigurations { Path = "a", Filename = "b", IsCaseSensitive = true }, DateTime.Now.AddDays(1)); var configs = ConfigurationAnalyser.GetEcConfigConfigurations(); Assert.AreEqual("a", configs.Path); }
public static Property Get(string key) { //Get EcConfigs var ecConfs = ConfigurationAnalyser.GetEcConfigConfigurations(); //Get client config properties var potProperty = PropertiesExtractor.GetProperties(ecConfs).FirstOrDefault(x => x.Key.Equals(ecConfs.IsCaseSensitive ? key : key.ToLower())); //Return result or empty string return(potProperty.Key == null ? new Property(string.Empty) : new Property(potProperty.Value)); }
public void GetEcConfigConfigurations_NominalCase() { Assert.IsFalse(MemoryCache.Default.Any(x => x.Key == EcConfigResources.CacheKey_EcConfigs)); var configs = ConfigurationAnalyser.GetEcConfigConfigurations(); Assert.AreEqual("./folder", configs.Path); Assert.AreEqual("dev", configs.Filename); Assert.IsTrue(configs.IsCaseSensitive); Assert.IsTrue(MemoryCache.Default.Any(x => x.Key == EcConfigResources.CacheKey_EcConfigs)); }
public void GetEcConfigConfigurations_InvalidIsCasSensitive() { ConfigurationManager.AppSettings[Configurations.IsCaseSensitive] = "truee"; ConfigurationAnalyser.GetEcConfigConfigurations(); }
public void GetEcConfigConfigurations_InvalidFilesPath() { ConfigurationManager.AppSettings[Configurations.Path] = "<test/ok"; ConfigurationAnalyser.GetEcConfigConfigurations(); }
public void GetEcConfigConfigurations_InvalidCurrentFilename() { ConfigurationManager.AppSettings[Configurations.Filename] = "²<>test"; ConfigurationAnalyser.GetEcConfigConfigurations(); }