public void TestSetup() { this.logger = new GenericLogger(); this.xmlLoader = new XmlLoader(this.logger); string xmlString; using (Stream s = typeof(CommandDefinitionCollection).Assembly.GetManifestResourceStream("Chaskis.Plugins.MeetBot.Config.SampleCommands.xml")) { using (StreamReader reader = new StreamReader(s)) { xmlString = reader.ReadToEnd(); } } // Replace all occurrances with !command instead of #command. xmlString = xmlString.Replace("<prefix>#", "<prefix>!"); // Load both default and user-defined. User-defined will override the default ones. IList <CommandDefinition> defaultDefs = this.xmlLoader.ParseDefaultFile(); IList <CommandDefinition> userDefs = this.xmlLoader.ParseCommandFileFromString(xmlString); List <CommandDefinition> allDefs = new List <CommandDefinition>(defaultDefs); allDefs.AddRange(userDefs); this.collection = new CommandDefinitionCollection(allDefs); // Ensure our collection validates. Assert.DoesNotThrow(() => collection.InitStage1_ValidateDefinitions()); Assert.DoesNotThrow(() => collection.InitStage2_FilterOutOverrides()); }
public void TestSetup() { this.logger = new GenericLogger(); this.xmlLoader = new XmlLoader(this.logger); IList <CommandDefinition> defs = this.xmlLoader.ParseDefaultFile(); this.collection = new CommandDefinitionCollection(defs); // Ensure our collection validates. Assert.DoesNotThrow(() => collection.InitStage1_ValidateDefinitions()); Assert.DoesNotThrow(() => collection.InitStage2_FilterOutOverrides()); }