public void DefinePreprocessorConstant_WhenConstantIsNull_Throws() { var loader = new PluginLoader(); Assert.Throws<ArgumentNullException>(() => loader.DefinePreprocessorConstant(null)); }
public void PopulateCatalog_WhenPluginXmlContainsPreprocessorInstructions_AppliesThem() { string pluginContents = "<plugin pluginId=\"pluginId\" xmlns=\"http://www.gallio.org/\"><traits><?ifdef A?><name>A</name><?endif?><?ifdef B?><property>B</property><?endif?></traits></plugin>"; var loader = new PluginLoader(); var catalog = MockRepository.GenerateMock<IPluginCatalog>(); loader.AddPluginXml(pluginContents, new DirectoryInfo(@"C:\")); loader.DefinePreprocessorConstant("A"); Plugin plugin = null; catalog.Expect(x => x.AddPlugin(null, null)).IgnoreArguments() .Do((Gallio.Common.Action<Plugin, DirectoryInfo>)delegate(Plugin pluginArg, DirectoryInfo baseDirectoryArg) { plugin = pluginArg; }); loader.PopulateCatalog(catalog, NullProgressMonitor.CreateInstance()); catalog.VerifyAllExpectations(); // added one plugin Assert.AreEqual(new PropertySet() { { "name", "A" } }, plugin.Traits.PropertySet); }