[Test] // Bug fix
        public void NotInfiniteLoopRemovingAnApplicationWithAManagerThatThrowsExceptionWhenStopped()
        {
            factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher);
            watcherMock.Expect("StartWatching");
            watcherMock.ExpectAndThrow("StopWatching", new Exception());
            AddApplication();
            ForwardingDeployEventDispatcher dispatcher = new ForwardingDeployEventDispatcher();

            dispatcher.DeployEvent += new DeployEventHandler(dispatcher_DeployEvent);
            location = new FileSystemDeployLocation(dispatcher, factory, deployPath, true);
            Directory.Delete(sampleDir, true);
            forwardDispatcherSync.Acquire();
            Assert.IsTrue(deployEventDispatched, "removal not dispatched in case of error on application watcher");
        }
 [Test] // Bug fix
 public void NotInfiniteLoopRemovingAnApplicationWithAManagerThatThrowsExceptionWhenDisposed ()
 {
     factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher);
     watcherMock.Expect("StartWatching");
     watcherMock.Expect("StopWatching");
     watcherMock.ExpectAndThrow("Dispose", new Exception());
     AddApplication();
     ForwardingDeployEventDispatcher dispatcher = new ForwardingDeployEventDispatcher();
     dispatcher.DeployEvent += new DeployEventHandler(dispatcher_DeployEvent);
     location = new FileSystemDeployLocation (dispatcher, factory, deployPath, true);
     Directory.Delete(sampleDir, true);
     forwardDispatcherSync.Acquire();
     Assert.IsTrue(deployEventDispatched, "removal not dispatched in case of error on application watcher");
 }