/// <summary>
 /// Gets the default configuration path for a type that implements <see cref="ConfigurationSection"/>.
 /// </summary>
 /// <remarks>
 /// <para>
 /// For configuration sections decorated with <see cref="ConfigurationPathAttribute"/>, this method returns the
 /// path specified in the attribute.
 /// </para>
 /// <para>
 /// For all other types, the return value is equivalent to the full name of the specified type, substituting the
 /// period <c>'.'</c> character with a forward-slash character <c>'/'</c>
 /// </para>
 /// </remarks>
 /// <returns>
 /// The default path (in the configuration file) to the specified section.
 /// </returns>
 /// <typeparam name='TSection'>
 /// The type of configuration section for which we want to generate a default path.
 /// </typeparam>
 public static string GetDefaultConfigurationPath <TSection>() where TSection : ConfigurationSection
 => readerSingleton.GetDefaultSectionPath <TSection>();
Example #2
0
        public void GetDefaultSectionPath_returns_default_path_based_on_namespace_when_no_attribute_present()
        {
            string path = sut.GetDefaultSectionPath <MockConfigurationSection>();

            Assert.AreEqual("Test/CSF/Configuration/MockConfigurationSection", path);
        }