示例#1
0
        public void GetPlugins_Throws_AssemblyNotFound()
        {
            var enumerator = new AssemblyBotPluginEnumerator(AssemblyLoadContext.Default);

            Assert.Throws <FileNotFoundException>(
                () => enumerator.GetPlugins(pluginName: "Fake.Assembly.Name").ToList());
        }
示例#2
0
        public void GetPlugins_Throws_InvalidAssemblyName()
        {
            var enumerator = new AssemblyBotPluginEnumerator(AssemblyLoadContext.Default);

            Assert.Throws <FileLoadException>(
                () => enumerator.GetPlugins(pluginName: "*//\\-_+!?#$").ToList());
        }
示例#3
0
        public void GetPlugins_Throws_ArgumentNullException(string pluginName)
        {
            var enumerator = new AssemblyBotPluginEnumerator(AssemblyLoadContext.Default);

            Assert.Throws <ArgumentNullException>(
                "pluginName",
                () => enumerator.GetPlugins(pluginName).ToList());
        }
示例#4
0
        public void GetPlugins_Succeeds()
        {
            var enumerator = new AssemblyBotPluginEnumerator(AssemblyLoadContext.Default);

            IList <IBotPlugin> plugins = enumerator.GetPlugins(Assembly.GetExecutingAssembly().FullName).ToList();

            Assert.Equal(3, plugins.Count);
            Assert.Contains(plugins, p => typeof(PublicBotPlugin) == p.GetType());
            Assert.Contains(plugins, p => typeof(AdventureWorksAdapterPlugin) == p.GetType());
            Assert.Contains(plugins, p => typeof(ContosoAdapterPlugin) == p.GetType());
        }