public void ProduceUpdateEventsForWatchedApplication()
        {
            TestingDispatcher controlledDispatcher = new TestingDispatcher();

            controlledDispatcher.DeployEvent += new DeployEventHandler(controlledDispatcher_DeployEvent);
            watcher.StartWatching(controlledDispatcher);
            string subDir = Path.Combine(appFullPath, "foo");

            Directory.CreateDirectory(subDir);
            controlledDispatcher.WaitAndPerformDispatch(null);

            using (File.Create(Path.Combine(subDir, "foo.bar"))) {}
            controlledDispatcher.WaitAndPerformDispatch(null);
        }
        public void CanBeConfiguredToIncludeOrExcludePathsForEvents()
        {
            string           simple = "Data/Xml/watcher-simple.xml";
            XmlObjectFactory f      = new XmlObjectFactory(new FileSystemResource(simple));

            f.RegisterSingleton(DefaultApplicationWatcherFactory.InjectedApplicationName, application);
            watcher = f["watcher"] as FileSystemApplicationWatcher;
            Assert.IsNotNull(watcher,
                             String.Format("test file [{0}] should define a file sistem resource!", simple));
            Assert.AreEqual(1, watcher.Excludes.Count);
            Assert.AreEqual(1, watcher.Includes.Count);

            watcher.StartWatching(dispatcher);

            // propagated
            string subDir = Path.Combine(appFullPath, "foo");

            Directory.CreateDirectory(subDir);
            using (File.Create(Path.Combine(subDir, "foo.bar"))) {}
            eventLatch.Acquire();
            Assert.IsFalse(dispatched);
        }
        public void CanBeConfiguredToIncludeOrExcludePathsForEvents ()
        {
            string simple = "Data/Xml/watcher-simple.xml";
            XmlObjectFactory f = new XmlObjectFactory(new FileSystemResource(simple));
            f.RegisterSingleton(DefaultApplicationWatcherFactory.InjectedApplicationName, application);
            watcher = f["watcher"] as FileSystemApplicationWatcher;
            Assert.IsNotNull(watcher, 
                String.Format("test file [{0}] should define a file sistem resource!", simple));
            Assert.AreEqual(1, watcher.Excludes.Count);
            Assert.AreEqual(1, watcher.Includes.Count);

            watcher.StartWatching(dispatcher);

            // propagated
            string subDir = Path.Combine(appFullPath, "foo");
            Directory.CreateDirectory(subDir);
            using (File.Create(Path.Combine (subDir, "foo.bar"))) {}
            eventLatch.Acquire();            
            Assert.IsFalse(dispatched);
        }