Example #1
0
        public void TestAddTableListenerExKeyListenerFlags()
        {
            MockTableListener listener = new MockTableListener();

            NotifyFlags f = NotifyFlags.NotifyNew | NotifyFlags.NotifyLocal | NotifyFlags.NotifyImmediate;

            string key   = "key";
            string value = "Value";

            m_table.PutString(key, value);

            m_table.AddTableListenerEx(key, listener, f);

            m_table.PutString("Key2", "Value2");

            Thread.Sleep(20);

            Assert.That(listener.Source, Is.EqualTo(m_table));
            Assert.That(listener.Key, Is.EqualTo(key));
            Assert.That(listener.Value.IsString());
            Assert.That(listener.Value.GetString(), Is.EqualTo(value));
            Assert.That(listener.Flags, Is.EqualTo(NotifyFlags.NotifyImmediate));

            m_table.RemoveTableListener(listener);
        }
Example #2
0
        public void TestAddSubTableListenerNotLocal()
        {
            MockTableListener listener = new MockTableListener();

            m_table.AddSubTableListener(listener);

            Thread.Sleep(20);

            m_table.RemoveTableListener(listener);

            Assert.Pass();
        }
Example #3
0
        public void TestAddTableListenerKeyListener()
        {
            MockTableListener listener = new MockTableListener();

            m_table.AddTableListener("key", listener);

            Thread.Sleep(20);

            m_table.RemoveTableListener(listener);

            Assert.Pass();
        }
Example #4
0
        public void TestAddTableListenerEntireTableImmediateNotify()
        {
            MockTableListener listener = new MockTableListener();

            m_table.AddTableListener(listener, true);

            Thread.Sleep(20);

            m_table.RemoveTableListener(listener);

            Assert.Pass();
        }
Example #5
0
        public void TestAddSubTableListenerListenerLocalNotify()
        {
            MockTableListener listener = new MockTableListener();

            string subTableName = "SubTable";

            ITable subTable = m_table.GetSubTable("SubTable");

            m_table.AddSubTableListener(listener, true);

            string key   = "key";
            string value = "Value";

            subTable.PutString(key, value);

            Thread.Sleep(20);

            Assert.That(listener.Source, Is.EqualTo(m_table));
            Assert.That(listener.Key, Is.EqualTo(subTableName));
            Assert.That(listener.Value, Is.Null);
            Assert.That(listener.Flags, Is.EqualTo(NotifyFlags.NotifyLocal | NotifyFlags.NotifyNew));

            m_table.RemoveTableListener(listener);
        }