public void InstallPluginMultipleTimes()
        {
            var Manager = new Core.Plugins.PluginManager(new string[] { "http://localhost:8797/api/v2" }, Utilities.IoC.Manager.Bootstrapper);

            Manager.InstallPlugin("xunit");
            Manager.InstallPlugin("xunit");
            PluginList List = PluginList.Load();

            Assert.Equal(1, List.Plugins.Count);
            Plugin TempPlugin = PluginList.Load().Get("xunit");

            Assert.Equal(6, new DirectoryInfo("~/App_Data/plugins/xunit/").EnumerateFiles().Count());
            Assert.True(new FileInfo("~/App_Data/plugins/xunit/xunit.xml").Exists);
            Assert.True(new FileInfo("~/App_Data/plugins/xunit/xunit.runner.utility.dll").Exists);
            Assert.True(new FileInfo("~/App_Data/plugins/xunit/xunit.runner.tdnet.dll").Exists);
            Assert.True(new FileInfo("~/App_Data/plugins/xunit/xunit.runner.msbuild.dll").Exists);
            Assert.True(new FileInfo("~/App_Data/plugins/xunit/xunit.dll.tdnet").Exists);
            Assert.True(new FileInfo("~/App_Data/plugins/xunit/xunit.dll").Exists);
            Assert.NotNull(TempPlugin);
            Assert.Equal("JamesNewkirk,BradWilson", TempPlugin.Author.Replace(" ", ""));
            Assert.Equal("xUnit.net is a developer testing framework, built to support Test Driven Development, with a design goal of extreme simplicity and alignment with framework features.", TempPlugin.Description);
            Assert.Equal(6, TempPlugin.Files.Count);
            Assert.Equal("xUnit.net", TempPlugin.Name);
            Assert.Equal("1.9.2", TempPlugin.OnlineVersion);
            Assert.Equal("xunit", TempPlugin.PluginID);
            Assert.Equal(0, TempPlugin.Priority);
            Assert.Equal(null, TempPlugin.Tags);
            Assert.Equal(null, TempPlugin.Type);
            Assert.Equal(false, TempPlugin.UpdateAvailable);
            Assert.Equal("1.9.2", TempPlugin.Version);
        }
 /// <summary>
 /// Initializes this instance.
 /// </summary>
 public void Initialize()
 {
     Delete(new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "/App_Data/plugins/Loaded/"));
     new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "/App_Data/plugins/Loaded").Create();
     PluginList = PluginList.Load();
     if (PluginList.Plugins == null)
     {
         PluginList.Plugins = new List <Plugin>();
     }
     foreach (Plugin TempPlugin in PluginList.Plugins)
     {
         TempPlugin.Initialize();
     }
     PluginsInstalled = AppDomain.CurrentDomain.GetAssemblies().Objects <IPlugin>();
     foreach (IPlugin TempPlugin in PluginsInstalled)
     {
         Bootstrapper.AddAssembly(TempPlugin.GetType().Assembly);
         foreach (IPackageRepository Repo in PackageRepositories)
         {
             var Package = Repo.FindPackage(TempPlugin.PluginData.PluginID);
             if (Package != null)
             {
                 var TempPluginData = PluginList.Get(Package.Id);
                 TempPluginData.OnlineVersion = Package.Version.ToString();
             }
         }
     }
     PluginList.Save();
 }
        public void UninstallPlugin()
        {
            var Manager = new Core.Plugins.PluginManager(new string[] { "http://localhost:8797/api/v2" }, Utilities.IoC.Manager.Bootstrapper);

            Manager.InstallPlugin("xunit");
            Manager.UninstallPlugin("xunit");
            Assert.Equal(0, new DirectoryInfo("~/App_Data/plugins/xunit/").EnumerateFiles().Count());
            Assert.Null(PluginList.Load().Get("xunit"));
            Assert.Equal(0, PluginList.Load().Plugins.Count);
        }
        public void InstallPluginWithRequireds()
        {
            var Manager = new Core.Plugins.PluginManager(new string[] { "http://localhost:8797/api/v2" }, Utilities.IoC.Manager.Bootstrapper);

            Manager.InstallPlugin("Copernicus.Models.CRM");
            Plugin TempPlugin = PluginList.Load().Get("Copernicus.Models.CRM");

            Assert.Equal(1, new DirectoryInfo("~/App_Data/plugins/Copernicus.Models.CRM/").EnumerateFiles().Count());
            Assert.True(new FileInfo("~/App_Data/plugins/Copernicus.Models.CRM/Copernicus.Models.CRM.dll").Exists);
            Assert.Equal(1, new DirectoryInfo("~/App_Data/plugins/Copernicus.Models.Content/").EnumerateFiles().Count());
            Assert.True(new FileInfo("~/App_Data/plugins/Copernicus.Models.Content/Copernicus.Models.Content.dll").Exists);
            Assert.NotNull(TempPlugin);
            Assert.Equal("JamesCraig", TempPlugin.Author.Replace(" ", ""));
            Assert.Equal("Contains the models used by various plugins that need crm.", TempPlugin.Description);
            Assert.Equal(1, TempPlugin.Files.Count);
            Assert.Equal("Copernicus Models for CRM", TempPlugin.Name);
            Assert.Equal("1.0.2", TempPlugin.OnlineVersion);
            Assert.Equal("Copernicus.Models.CRM", TempPlugin.PluginID);
            Assert.Equal(0, TempPlugin.Priority);
            Assert.Equal("models crm", TempPlugin.Tags);
            Assert.Equal(null, TempPlugin.Type);
            Assert.Equal(false, TempPlugin.UpdateAvailable);
            Assert.Equal("1.0.2", TempPlugin.Version);
            TempPlugin = PluginList.Load().Get("Copernicus.Models.Content");
            Assert.NotNull(TempPlugin);
            Assert.Equal("JamesCraig", TempPlugin.Author.Replace(" ", ""));
            Assert.Equal("Contains the models used by various plugins that need content.", TempPlugin.Description);
            Assert.Equal(1, TempPlugin.Files.Count);
            Assert.Equal("Copernicus Models for Content", TempPlugin.Name);
            Assert.Equal("1.0.2", TempPlugin.OnlineVersion);
            Assert.Equal("Copernicus.Models.Content", TempPlugin.PluginID);
            Assert.Equal(0, TempPlugin.Priority);
            Assert.Equal("models content", TempPlugin.Tags);
            Assert.Equal(null, TempPlugin.Type);
            Assert.Equal(false, TempPlugin.UpdateAvailable);
            Assert.Equal("1.0.2", TempPlugin.Version);
        }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PluginBase" /> class.
 /// </summary>
 protected PluginBase()
 {
     PluginData = PluginList.Load().Get(ID);
 }