public void AnInvalidApplicationIsNotUpdatedNorRemovedButItWillNotBeListed()
        {
            Semaphore sync = new Semaphore(0);

            AddApplication();
            InitHandlerAndStartLocation(sync);
            File.Delete(serviceXml);
            Assert.IsFalse(sync.Attempt(1000), "some events propagated, expecting no one");
            Assert.IsFalse(handler.applicationUpdated, "application wrongly updated");
            Assert.IsFalse(handler.applicationRemoved, "application wrongly removed");
            Assert.AreEqual(0, location.Applications.Count, "application listed");

            location.Dispose();
            location = new FileSystemDeployLocation(deployPath);
            Assert.AreEqual(0, location.Applications.Count, "invalid application listed");
        }
        public void AnInvalidApplicationIsNotUpdatedNorRemovedButWhenRemovedStillRaisesTheRemovedEvent()
        {
            Semaphore sync = new Semaphore(0);

            AddApplication();
            InitHandlerAndStartLocation(sync);
            File.Delete(serviceXml);
            Assert.IsFalse(sync.Attempt(1000), "some events propagated, expecting no one");

            // remove
            TestUtils.SafeDeleteDirectory(sampleDir);
            Thread.SpinWait(1);
            Assert.IsFalse(Directory.Exists(sampleDir), "directory still exists");
            log.Debug("directory deleted");
            sync.Acquire();
            log.Debug("sync acquired");
            Assert.IsFalse(Directory.Exists(sampleDir), "directory still exists: " + sampleDir);
            Assert.IsTrue(handler.applicationRemoved, "application not removed");
            Assert.AreEqual(0, location.Applications.Count);
        }