public void Add_WeaveTest1() { Service1 s1 = new Service1(); Service2 s2 = new Service2(); ew.Add(s1); ew.Add(s2); s1.Trigger(); Assert.AreEqual(1, s2.EventCount); }
public void Add_WeaveDelegateTest() { int called = 0; Service1 s1 = new Service1(); ew.Add(s1); ew.Add( new EventHandler(delegate(object o, EventArgs e) { ++called; } )); s1.Trigger(); Assert.AreEqual(1, called); }
public void Add_WeaveTest2() { Service1 s1 = new Service1(); Service2 s2 = new Service2(); // Add in wrong order won't weave ew.Add(s2); ew.Add(s1); s1.Trigger(); Assert.AreEqual(0, s2.EventCount); }
public void Add_WeaveTest3() { Service1 s1 = new Service1(); Service3 s3 = new Service3(); Service4 s4 = new Service4(); ew.Add(s1); ew.Add(s3); ew.Add(s4); s1.Trigger(); Assert.AreEqual(1, s3.EventCount); Assert.AreEqual(1, s4.Event1Count); Assert.AreEqual(1, s4.Event2Count); }