Beispiel #1
0
        public void TestNoneDeletingPollingSource()
        {
            var config = new ConcurrentDictionaryConfiguration();

            config.AddProperty("prop1", "original");
            DummyPollingSource source = new DummyPollingSource(false);

            source.SetFull("");
            FixedDelayPollingScheduler     scheduler     = new FixedDelayPollingScheduler(0, 10, true);
            ConfigurationWithPollingSource pollingConfig = new ConfigurationWithPollingSource(config, source, scheduler);

            Thread.Sleep(200);
            Assert.AreEqual("original", pollingConfig.GetProperty("prop1"));
            source.SetFull("prop1=changed");
            Thread.Sleep(200);
            Assert.AreEqual("changed", pollingConfig.GetProperty("prop1"));
            source.SetFull("prop1=changedagain,prop2=new");
            Thread.Sleep(200);
            Assert.AreEqual("changedagain", pollingConfig.GetProperty("prop1"));
            Assert.AreEqual("new", pollingConfig.GetProperty("prop2"));
            source.SetFull("prop3=new");
            Thread.Sleep(200);
            Assert.AreEqual("changedagain", pollingConfig.GetProperty("prop1"));
            Assert.AreEqual("new", pollingConfig.GetProperty("prop2"));
            Assert.AreEqual("new", pollingConfig.GetProperty("prop3"));
        }
 public void TestNoneDeletingPollingSource()
 {
     var config = new ConcurrentDictionaryConfiguration();
     config.AddProperty("prop1", "original");
     DummyPollingSource source = new DummyPollingSource(false);
     source.SetFull("");
     FixedDelayPollingScheduler scheduler = new FixedDelayPollingScheduler(0, 10, true);
     ConfigurationWithPollingSource pollingConfig = new ConfigurationWithPollingSource(config, source, scheduler);
     Thread.Sleep(200);
     Assert.AreEqual("original", pollingConfig.GetProperty("prop1"));
     source.SetFull("prop1=changed");
     Thread.Sleep(200);
     Assert.AreEqual("changed", pollingConfig.GetProperty("prop1"));
     source.SetFull("prop1=changedagain,prop2=new");
     Thread.Sleep(200);
     Assert.AreEqual("changedagain", pollingConfig.GetProperty("prop1"));
     Assert.AreEqual("new", pollingConfig.GetProperty("prop2"));
     source.SetFull("prop3=new");
     Thread.Sleep(200);
     Assert.AreEqual("changedagain", pollingConfig.GetProperty("prop1"));
     Assert.AreEqual("new", pollingConfig.GetProperty("prop2"));
     Assert.AreEqual("new", pollingConfig.GetProperty("prop3"));
 }