public void ValidateSectionTest2() { CfgStarterSection cfg_starter = new CfgStarterSection(); var hostBuilder = new CoreHostBuilder(); var host = hostBuilder.Build(); var configuration = host.Services.GetService <IConfiguration>(); configuration.GetSection("ru:spinosa:starter").Bind(cfg_starter, options => options.BindNonPublicProperties = true); Assert.IsTrue(cfg_starter.Validate()); cfg_starter._this.servicename = null; Assert.IsFalse(cfg_starter.Validate()); Assert.ThrowsException <CoreException>(() => { cfg_starter.ValidateAndTrace("starter"); }); }
public void ValidateSectionTest() { CfgStarterSection cfg_starter = new CfgStarterSection(); var hostBuilder = new CoreHostBuilder(); var host = hostBuilder.Build(); var configuration = host.Services.GetService <IConfiguration>(); configuration.GetSection("ru:spinosa:starter").Bind(cfg_starter, options => options.BindNonPublicProperties = true); Assert.IsTrue(cfg_starter.Validate()); }