Esempio n. 1
0
        public void CanReadAndWriteConfigurationSourceConfiguration()
        {
            manager.Register(ServiceProvider);
            Assert.AreEqual(0, ErrorLogService.ValidationErrorCount);
            Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount);

            ApplicationNode.AddNode(GetSectionNode());
            manager.Save(ServiceProvider);
            Assert.AreEqual(0, ErrorLogService.ValidationErrorCount);
            Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount);

            ApplicationNode.ClearChildNodes();
            manager.Open(ServiceProvider);
            Assert.AreEqual(0, ErrorLogService.ValidationErrorCount);
            Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount);

            ConfigurationSourceSectionNode node = (ConfigurationSourceSectionNode)ApplicationNode.Nodes[0];

            Assert.IsNotNull(node);
            Assert.AreEqual(2, node.Nodes.Count);
            Assert.AreEqual(typeof(FileConfigurationSourceElementNode), node.SelectedSource.GetType());

            ApplicationNode.ClearChildNodes();

            manager.Save(ServiceProvider);
            Assert.AreEqual(0, ErrorLogService.ValidationErrorCount);
            Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount);
        }
        public void CanReadAndWriteInstrumentationConfiguration()
        {
            manager.Register(ServiceProvider);
            Assert.AreEqual(0, ErrorLogService.ValidationErrorCount);
            Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount);

            ApplicationNode.AddNode(new InstrumentationNode(new InstrumentationConfigurationSection(true, true, false)));
            manager.Save(ServiceProvider);
            Assert.AreEqual(0, ErrorLogService.ValidationErrorCount);
            Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount);

            ApplicationNode.ClearChildNodes();
            manager.Open(ServiceProvider);
            Assert.AreEqual(0, ErrorLogService.ValidationErrorCount);
            Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount);

            InstrumentationNode node = (InstrumentationNode)ApplicationNode.Nodes[0];

            Assert.IsNotNull(node);
            Assert.IsTrue(node.EventLoggingEnabled);
            Assert.IsTrue(node.PerformanceCountersEnabled);
            Assert.IsFalse(node.WmiEnabled);

            ApplicationNode.ClearChildNodes();

            manager.Save(ServiceProvider);
            Assert.AreEqual(0, ErrorLogService.ValidationErrorCount);
            Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount);
        }