예제 #1
0
        public void TestImmediateFilterStore()
        {
            var env = new Environment();
            var res = new MyFilterStore(env);

            Assert.AreEqual(0, res.Count);
            Assert.AreEqual(0, res.PutQueueLength);
            Assert.AreEqual(0, res.GetQueueLength);

            var put = res.Put(1);

            Assert.IsTrue(put.IsTriggered);
            Assert.AreEqual(1, res.Count);
            Assert.AreEqual(0, res.PutQueueLength);
            Assert.AreEqual(0, res.GetQueueLength);

            var get = res.Get();

            Assert.IsTrue(get.IsTriggered);
            Assert.AreEqual(0, res.Count);
            Assert.AreEqual(0, res.PutQueueLength);
            Assert.AreEqual(0, res.GetQueueLength);

            get = res.Get();
            Assert.IsFalse(get.IsTriggered);
            Assert.AreEqual(0, res.Count);
            Assert.AreEqual(0, res.PutQueueLength);
            Assert.AreEqual(1, res.GetQueueLength);

            put = res.Put(1);
            Assert.IsTrue(put.IsTriggered);
            Assert.AreEqual(1, res.Count);
            Assert.AreEqual(0, res.PutQueueLength);
            Assert.AreEqual(1, res.GetQueueLength);

            env.Run();
            Assert.IsTrue(get.IsTriggered);
            Assert.AreEqual(0, res.Count);
            Assert.AreEqual(0, res.PutQueueLength);
            Assert.AreEqual(0, res.GetQueueLength);
        }
예제 #2
0
        public void TestImmediateFilterStore()
        {
            var env = new Environment();
              var res = new MyFilterStore(env);
              Assert.AreEqual(0, res.Count);
              Assert.AreEqual(0, res.PutQueueLength);
              Assert.AreEqual(0, res.GetQueueLength);

              var put = res.Put(1);
              Assert.IsTrue(put.IsTriggered);
              Assert.AreEqual(1, res.Count);
              Assert.AreEqual(0, res.PutQueueLength);
              Assert.AreEqual(0, res.GetQueueLength);

              var get = res.Get();
              Assert.IsTrue(get.IsTriggered);
              Assert.AreEqual(0, res.Count);
              Assert.AreEqual(0, res.PutQueueLength);
              Assert.AreEqual(0, res.GetQueueLength);

              get = res.Get();
              Assert.IsFalse(get.IsTriggered);
              Assert.AreEqual(0, res.Count);
              Assert.AreEqual(0, res.PutQueueLength);
              Assert.AreEqual(1, res.GetQueueLength);

              put = res.Put(1);
              Assert.IsTrue(put.IsTriggered);
              Assert.AreEqual(1, res.Count);
              Assert.AreEqual(0, res.PutQueueLength);
              Assert.AreEqual(1, res.GetQueueLength);

              env.Run();
              Assert.IsTrue(get.IsTriggered);
              Assert.AreEqual(0, res.Count);
              Assert.AreEqual(0, res.PutQueueLength);
              Assert.AreEqual(0, res.GetQueueLength);
        }