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())); }
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())); }