public void OffAll() { var log = LogManager.GetLogger(Global.CallerName()); log.Info("Start"); var emitter = new Emitter(); var calls = new List <object>(); var listener3 = new TestListener3(calls); var listener4 = new TestListener4(calls); emitter.On("foo", listener3); emitter.On("bar", listener4); emitter.Emit("foo"); emitter.Emit("bar"); emitter.Off(); emitter.Emit("foo"); emitter.Emit("bar"); var expected = new Object[] { "one", "two" }; CollectionAssert.AreEqual(expected, calls.ToArray()); }
public void OffAll() { var emitter = new Emitter(); var calls = new List <object>(); var listener3 = new TestListener3(calls); var listener4 = new TestListener4(calls); emitter.On("foo", listener3); emitter.On("bar", listener4); emitter.Emit("foo"); emitter.Emit("bar"); emitter.Off(); emitter.Emit("foo"); emitter.Emit("bar"); var expected = new Object[] { "one", "two" }; Assert.Equal(expected, calls.ToArray()); }
public void OffAll() { LogManager.SetupLogManager(); var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()); log.Info("Start"); var emitter = new Emitter(); var calls = new List <object>(); var listener3 = new TestListener3(calls); var listener4 = new TestListener4(calls); emitter.On("foo", listener3); emitter.On("bar", listener4); emitter.Emit("foo"); emitter.Emit("bar"); emitter.Off(); emitter.Emit("foo"); emitter.Emit("bar"); var expected = new Object[] { "one", "two" }; Assert.Equal(expected, calls.ToArray()); }
public void HasListeners() { var emitter = new Emitter(); var calls = new List <object>(); Assert.False(emitter.HasListeners("foo")); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); Assert.True(emitter.HasListeners("foo")); }
public void Listeners() { var emitter = new Emitter(); var calls = new List <object>(); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); var expected = new IListener[] { listener3 }; Assert.Equal(expected, emitter.Listeners("foo").ToArray()); }
public void HasListeners() { var log = LogManager.GetLogger(Global.CallerName()); log.Info("Start"); var emitter = new Emitter(); var calls = new List<object>(); Assert.AreEqual(false, emitter.HasListeners("foo")); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); Assert.AreEqual(true, emitter.HasListeners("foo")); }
public void Listeners() { var log = LogManager.GetLogger(Global.CallerName()); log.Info("Start"); var emitter = new Emitter(); var calls = new List<object>(); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); var expected = new IListener[] {listener3}; Assert.AreEqual(expected.Count(), emitter.Listeners("foo").ToArray().Count()); CollectionAssert.AreEqual(expected, emitter.Listeners("foo").ToArray()); }
public void Listeners() { LogManager.SetupLogManager(); var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()); log.Info("Start"); var emitter = new Emitter(); var calls = new List<object>(); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); var expected = new IListener[] {listener3}; Assert.Equal(expected, emitter.Listeners("foo").ToArray()); }
public void HasListeners() { LogManager.SetupLogManager(); var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()); log.Info("Start"); var emitter = new Emitter(); var calls = new List<object>(); Assert.Equal(false, emitter.HasListeners("foo")); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); Assert.Equal(true, emitter.HasListeners("foo")); }
public void HasListeners() { var log = LogManager.GetLogger(Global.CallerName()); log.Info("Start"); var emitter = new Emitter(); var calls = new List <object>(); Assert.AreEqual(false, emitter.HasListeners("foo")); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); Assert.AreEqual(true, emitter.HasListeners("foo")); }
public void OffWithOnce() { var emitter = new Emitter(); var calls = new List <object>(); var listener3 = new TestListener3(calls); emitter.Once("foo", listener3); emitter.Off("foo", listener3); emitter.Emit("foo"); var expected = new Object[] {}; Assert.Equal(expected, calls.ToArray()); }
public void Listeners() { var log = LogManager.GetLogger(Global.CallerName()); log.Info("Start"); var emitter = new Emitter(); var calls = new List <object>(); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); var expected = new IListener[] { listener3 }; Assert.AreEqual(expected.Count(), emitter.Listeners("foo").ToArray().Count()); CollectionAssert.AreEqual(expected, emitter.Listeners("foo").ToArray()); }
public void Listeners() { LogManager.SetupLogManager(); var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()); log.Info("Start"); var emitter = new Emitter(); var calls = new List <object>(); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); var expected = new IListener[] { listener3 }; Assert.Equal(expected, emitter.Listeners("foo").ToArray()); }
public void HasListeners() { LogManager.SetupLogManager(); var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()); log.Info("Start"); var emitter = new Emitter(); var calls = new List <object>(); Assert.False(emitter.HasListeners("foo")); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); Assert.True(emitter.HasListeners("foo")); }
public void Off() { var log = LogManager.GetLogger(Global.CallerName()); log.Info("Start"); var emitter = new Emitter(); var calls = new List<object>(); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); var listener4 = new TestListener4(calls); emitter.On("foo", listener4); emitter.Off("foo", listener4); emitter.Emit("foo"); var expected = new Object[] {"one"}; CollectionAssert.AreEqual(expected, calls.ToArray()); }
public void OffWithOnce() { LogManager.SetupLogManager(); var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()); log.Info("Start"); var emitter = new Emitter(); var calls = new List <object>(); var listener3 = new TestListener3(calls); emitter.Once("foo", listener3); emitter.Off("foo", listener3); emitter.Emit("foo"); var expected = new Object[] {}; CollectionAssert.AreEqual(expected, calls.ToArray()); }
public void Off() { LogManager.SetupLogManager(); var log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()); log.Info("Start"); var emitter = new Emitter(); var calls = new List<object>(); var listener3 = new TestListener3(calls); emitter.On("foo", listener3); var listener4 = new TestListener4(calls); emitter.On("foo", listener4); emitter.Off("foo", listener4); emitter.Emit("foo"); var expected = new Object[] {"one"}; Assert.Equal(expected, calls.ToArray()); }