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 ShouldRaiseAssemblyRemovedOnKnownFileLost() { AssemblyContainer tested = new AssemblyContainer(); MockPluginDirectory pluginDir = new MockPluginDirectory(); tested.AddDir(pluginDir); bool assemblyRemovedRaised = false; tested.AssemblyRemoved += (s, e) => assemblyRemovedRaised = true; pluginDir.RaiseFileFound(GetType().Assembly.Location); pluginDir.RaiseFileLost(GetType().Assembly.Location); Assert.IsTrue(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); }