public void GetSection_Success() { var teste = OptionsHelper.GetSection <TestOptions>(Configuration); Assert.AreEqual("string", teste["OptionString"]); Assert.AreEqual("999", teste["OptionInteger"]); Assert.AreEqual("True", teste["OptionBoolean"]); Assert.AreEqual("99.1", teste["OptionDouble"]); }
public void GetSection_Null_Throw_Exception() { OptionsHelper.GetSection <TestOptions>(null); }
public static IServiceCollection ConfigureOption <T>(this IServiceCollection services, IConfiguration configuration) where T : BaseOptions { services.Configure <T>(OptionsHelper.GetSection <T>(configuration)); return(services); }