public void LoadPluginsAndFilterByName()
        {
            IPluginManagerView view;

            var mocks = PrepareViewModelMocks(out view);
            var pluginLoader = mocks.DynamicMock<IPluginLoader>();

            var actionPlugin1 = new DummyActionPlugin("Dummy", Guid.Parse("10000000-0000-0000-0000-000000000000"));
            var actionPlugin2 = new DummyActionPlugin("Ummmy", Guid.Parse("20000000-0000-0000-0000-000000000000"));
            var actionPlugin3 = new DummyActionPlugin("Dummmmy", Guid.Parse("30000000-0000-0000-0000-000000000000"));

            Expect.Call(pluginLoader.LoadFile("dummy.plugin")).Return(new ActionPluginDetails()
            {
                ActionPlugin =
                    actionPlugin1,
                Enabled = true
            });

            Expect.Call(pluginLoader.LoadFile("dummy2.plugin")).Return(new ActionPluginDetails()
            {
                ActionPlugin =
                    actionPlugin2,
                Enabled = true
            });

            Expect.Call(pluginLoader.LoadFile("dummy3.plugin")).Return(new ActionPluginDetails()
            {
                ActionPlugin =
                    actionPlugin3,
                Enabled = true
            });

            Expect.Call(view.Notify).IgnoreArguments();

            mocks.ReplayAll();

            var model = new PluginManagerModel(pluginLoader);

            model.Subscribe(view);
            model.SetPluginFilterText("Dumm");

            Assert.AreEqual( 0, model.LoadPluginFrom("dummy.plugin"));
            Assert.AreEqual(-1, model.LoadPluginFrom("dummy2.plugin"));
            Assert.AreEqual( 1, model.LoadPluginFrom("dummy3.plugin"));

            mocks.VerifyAll();
        }
        public void LoadTheSamePluginsWithDifferentPathNames()
        {
            IPluginManagerView view;

            var mocks = PrepareViewModelMocks(out view);
            var pluginLoader = mocks.DynamicMock<IPluginLoader>();

            var actionPlugin1 = new DummyActionPlugin("Dummy", Guid.Parse("10000000-0000-0000-0000-000000000000"));
            var actionPlugin2 = new DummyActionPlugin("Dummy", Guid.Parse("10000000-0000-0000-0000-000000000000"));

            Expect.Call(pluginLoader.LoadFile("dummy.plugin")).Return(new ActionPluginDetails()
                                                                          {
                                                                              ActionPlugin =
                                                                                  actionPlugin1,
                                                                              Enabled = true
                                                                          });

            Expect.Call(pluginLoader.LoadFile("dummy2.plugin")).Return(new ActionPluginDetails()
                                                                           {
                                                                               ActionPlugin =
                                                                                   actionPlugin2,
                                                                               Enabled = true
                                                                           });
            Expect.Call(() => view.Notify()).Repeat.Once();

            mocks.ReplayAll();

            var model = new PluginManagerModel(pluginLoader);

            model.Subscribe(view);

            Assert.AreEqual(0, model.LoadPluginFrom("dummy.plugin"));
            Assert.AreEqual(0, model.LoadPluginFrom("dummy2.plugin"));
        }
        public void NotifyViewAfterPluginLoad()
        {
            IPluginManagerView view;

            var mocks = PrepareViewModelMocks(out view);
            var pluginLoader = mocks.DynamicMock<IPluginLoader>();

            Expect.Call(pluginLoader.LoadFile("dummy.plugin")).Return(new ActionPluginDetails()
                                                                          {
                                                                              ActionPlugin =
                                                                                  mocks.DynamicMock<IActionPlugin>(),
                                                                              Enabled = true
                                                                          });
            Expect.Call(view.Notify).IgnoreArguments();

            mocks.ReplayAll();

            var model = new PluginManagerModel(pluginLoader);

            model.Subscribe(view);

            Assert.AreEqual(model.LoadPluginFrom("dummy.plugin"), 0);

            mocks.VerifyAll();
        }