Example #1
0
 /// <summary>
 /// Gets dictionary of values from environment\setting file or empty Dictionary if path doesn't exist in file and environment variables.
 /// Exception will not be thrown.
 /// Note that each value of dictionary that is present in settings file can be overriden via Environment variable with the same name;
 /// (e.g. for capability "safebrowsing.enabled" at dictionary path ".driverSettings.chrome.options" you can set environment variable "driverSettings.chrome.options.safebrowsing.enabled")
 /// </summary>
 /// <typeparam name="T">Type of a value.</typeparam>
 /// <param name="file">Settings file.</param>
 /// <param name="path">Path to a value. Depends on file format, it can be xpath, path etc.</param>
 /// <returns>Dictionary of values or empty Dictionary.</returns>
 public static IReadOnlyDictionary <string, T> GetValueDictionaryOrEmpty <T>(this ISettingsFile file, string path)
 {
     return(file.IsValuePresent(path) ? file.GetValueDictionary <T>(path) : new Dictionary <string, T>());
 }