public void TestGetPluginStatusForNonPlugin()
        {
            using (var loader = new PluginArchiveLoader(_filesystem, Constants.PluginPath))
            {
                var status = loader.GetStatus(null);
                status.Should().NotBeNull();
                status.IsInstalled.Should().BeFalse();
                status.IsLoaded.Should().BeFalse();


                status = loader.GetStatus(new PluginId("dawawd"));
                status.Should().NotBeNull();
                status.IsInstalled.Should().BeFalse();
                status.IsLoaded.Should().BeFalse();
            }
        }
Exemple #2
0
        public void TestGetPluginStatusForNonPlugin()
        {
            using (var loader = new PluginArchiveLoader(null))
            {
                var status = loader.GetStatus(null);
                status.Should().NotBeNull();
                status.IsInstalled.Should().BeFalse();
                status.IsLoaded.Should().BeFalse();


                var description = new Mock <IPluginDescription>();
                status = loader.GetStatus(description.Object);
                status.Should().NotBeNull();
                status.IsInstalled.Should().BeFalse();
                status.IsLoaded.Should().BeFalse();
            }
        }
Exemple #3
0
        public void TestGetPluginStatusForInstalledPlugin()
        {
            using (var stream = new MemoryStream())
            {
                CreatePlugin(stream);

                using (var loader = new PluginArchiveLoader(null))
                {
                    var description = loader.ReflectPlugin(stream, true);
                    var status      = loader.GetStatus(description);
                    status.Should().NotBeNull();
                    status.IsInstalled.Should().BeTrue("because we've just installed that plugin");
                    status.IsLoaded.Should().BeFalse("because we haven't tried to load the plugin just yet");
                    status.LoadException.Should().BeNull("because we haven't tried to load the plugin just yet");
                }
            }
        }
        public void TestGetPluginStatusForInstalledPlugin()
        {
            using (var stream = new MemoryStream())
            {
                var id = CreatePlugin(stream);
                _filesystem.Write(Path.Combine(Constants.PluginPath, $"{id}.2.tvp"), stream);

                using (var loader = new PluginArchiveLoader(_filesystem, Constants.PluginPath))
                {
                    loader.Plugins.Should().HaveCount(1, "because one plugin should've been loaded");
                    var status = loader.GetStatus(id);
                    status.Should().NotBeNull();
                    status.IsInstalled.Should().BeTrue("because we've just installed that plugin");
                    status.IsLoaded.Should().BeTrue("because we successfully loaded the plugin");
                    status.LoadException.Should().BeNull("because we successfully loaded the plugin");
                }
            }
        }