Beispiel #1
0
        public void OffWhenCalledfromEvent()
        {
            var log = LogManager.GetLogger(Global.CallerName());

            log.Info("Start");

            var emitter = new Emitter();
            var called  = new List <bool>()
            {
                false
            };


            var listener5 = new TestListener5(called);
            var listener6 = new TestListener6(emitter, listener5);

            emitter.On("tobi", listener6);

            emitter.Once("tobi", listener5);
            emitter.Emit("tobi");
            Assert.AreEqual(true, called[0]);
            called[0] = false;
            emitter.Emit("tobi");
            Assert.AreEqual(false, called[0]);
        }
Beispiel #2
0
        public void OffWhenCalledfromEvent()
        {
            LogManager.SetupLogManager();
            var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod());

            log.Info("Start");

            var emitter = new Emitter();
            var called  = new List <bool>()
            {
                false
            };


            var listener5 = new TestListener5(called);
            var listener6 = new TestListener6(emitter, listener5);

            emitter.On("tobi", listener6);

            emitter.Once("tobi", listener5);
            emitter.Emit("tobi");
            Assert.True(called[0]);
            called[0] = false;
            emitter.Emit("tobi");
            Assert.False(called[0]);
        }
        public void OffWhenCalledfromEvent()
        {
            var emitter = new Emitter();
            var called  = new List <bool> {
                false
            };


            var listener5 = new TestListener5(called);
            var listener6 = new TestListener6(emitter, listener5);

            emitter.On("tobi", listener6);

            emitter.Once("tobi", listener5);
            emitter.Emit("tobi");
            Assert.True(called[0]);
            called[0] = false;
            emitter.Emit("tobi");
            Assert.False(called[0]);
        }
        public void OffWhenCalledfromEvent()
        {
            var log = LogManager.GetLogger(Global.CallerName());
            log.Info("Start");

            var emitter = new Emitter();
            var called = new List<bool>() {false};

            var listener5 = new TestListener5(called);
            var listener6 = new TestListener6(emitter, listener5);
            emitter.On("tobi", listener6);

            emitter.Once("tobi", listener5);
            emitter.Emit("tobi");
            Assert.AreEqual(true, called[0]);
            called[0] = false;
            emitter.Emit("tobi");
            Assert.AreEqual(false, called[0]);
        }
        public void OffWhenCalledfromEvent()
        {
            LogManager.SetupLogManager();
            var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod());
            log.Info("Start");

            var emitter = new Emitter();
            var called = new List<bool>() {false};

            var listener5 = new TestListener5(called);
            var listener6 = new TestListener6(emitter, listener5);
            emitter.On("tobi", listener6);

            emitter.Once("tobi", listener5);
            emitter.Emit("tobi");
            Assert.Equal(true, called[0]);
            called[0] = false;
            emitter.Emit("tobi");
            Assert.Equal(false, called[0]);
        }