public void ShouldRaiseAssemblyAddedOnFileFound()
        {
            AssemblyContainer   tested    = new AssemblyContainer();
            MockPluginDirectory pluginDir = new MockPluginDirectory();

            tested.AddDir(pluginDir);

            bool assemblyAddedRaised = false;

            tested.AssemblyAdded += (s, e) => assemblyAddedRaised = true;

            pluginDir.RaiseFileFound(GetType().Assembly.Location);

            Assert.IsTrue(assemblyAddedRaised);
        }
        public void ShouldForgetLostFile()
        {
            AssemblyContainer   tested    = new AssemblyContainer();
            MockPluginDirectory pluginDir = new MockPluginDirectory();

            tested.AddDir(pluginDir);

            int assemblyRemovedRaised = 0;

            tested.AssemblyRemoved += (s, e) => assemblyRemovedRaised++;

            pluginDir.RaiseFileFound(GetType().Assembly.Location);
            pluginDir.RaiseFileLost(GetType().Assembly.Location);
            pluginDir.RaiseFileLost(GetType().Assembly.Location);

            Assert.AreEqual(1, assemblyRemovedRaised);
        }
        public void RemovedDirDoesNotRaiseEvents()
        {
            AssemblyContainer   tested    = new AssemblyContainer();
            MockPluginDirectory pluginDir = new MockPluginDirectory();

            tested.AddDir(pluginDir);

            int assemblyAddedRaised   = 0;
            int assemblyRemovedRaised = 0;

            tested.AssemblyAdded   += (s, e) => assemblyAddedRaised++;
            tested.AssemblyRemoved += (s, e) => assemblyRemovedRaised++;

            tested.RemoveDir(pluginDir);
            pluginDir.RaiseFileFound(GetType().Assembly.Location);
            pluginDir.RaiseFileLost(GetType().Assembly.Location);

            Assert.AreEqual(0, assemblyAddedRaised);
            Assert.AreEqual(0, assemblyRemovedRaised);
        }