示例#1
0
        public void ExistsSection_command_True()
        {
            CommandsComplexSection sectionCommands = ConfigurationManager.GetSection(CommandsComplexSection.SectionName) as CommandsComplexSection;

            Assert.That(sectionCommands, Is.Not.Null);
            CommandConfigurationElement[] elements = new CommandConfigurationElement[sectionCommands.Commands.Count];
            sectionCommands.Commands.CopyTo(elements, 0);
            Assert.That(elements.First(c => c.Name == "command1").Name, Is.EqualTo("command1"));
            Assert.That(elements.First(c => c.Name == "command2").Name, Is.EqualTo("command2"));
            Assert.Throws <InvalidOperationException>(() => elements.First(c => c.Name == "command" + Guid.NewGuid()));
        }
示例#2
0
        public void NotExistsSection_command_False()
        {
            CommandsComplexSection sectionCommands = ConfigurationManager.GetSection("commandComplex" + Guid.NewGuid()) as CommandsComplexSection;

            Assert.That(sectionCommands, Is.Null);
        }