コード例 #1
0
        public void UnmapAllTest()
        {
            var count00 = 0;
            var count01 = 0;
            var count02 = 0;
            var count03 = 0;

            void Listener00() => count00++;
            void Listener01(int p1) => count01++;
            void Listener02(int p1, string p2) => count02++;
            void Listener03(int p1, string p2, bool p3) => count03++;

            _map.Map(TestEvent.Event00, Listener00);
            _map.Map(TestEvent.Event01, Listener01);
            _map.Map(TestEvent.Event02, Listener02);
            _map.Map(TestEvent.Event03, Listener03);

            Assert.AreEqual(true, _map.ContainsMapInfo(TestEvent.Event00, Listener00));
            Assert.AreEqual(true, _map.ContainsMapInfo(TestEvent.Event01, Listener01));
            Assert.AreEqual(true, _map.ContainsMapInfo(TestEvent.Event02, Listener02));
            Assert.AreEqual(true, _map.ContainsMapInfo(TestEvent.Event03, Listener03));

            _map.UnmapAll();

            Assert.AreEqual(false, _map.ContainsMapInfo(TestEvent.Event00, Listener00));
            Assert.AreEqual(false, _map.ContainsMapInfo(TestEvent.Event01, Listener01));
            Assert.AreEqual(false, _map.ContainsMapInfo(TestEvent.Event02, Listener02));
            Assert.AreEqual(false, _map.ContainsMapInfo(TestEvent.Event03, Listener03));

            _dispatcher.Dispatch(TestEvent.Event00);

            Assert.AreEqual(count00, 0);
            Assert.AreEqual(count01, 0);
            Assert.AreEqual(count02, 0);
            Assert.AreEqual(count03, 0);
        }