Exemplo n.º 1
0
        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"); });
        }
Exemplo n.º 2
0
        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());
        }