public void NoGhostMethodsAreIntroduced() { this.testee = new EventBroker(); ITestPublisher testPublisher = new MyPublisher(); ITestSubscriber testSubscriber = new MySubscriber(); int methodCount = testSubscriber.GetType().GetMethods().GetLength(0); this.testee.Register(testPublisher); Assert.AreEqual(methodCount, testSubscriber.GetType().GetMethods().GetLength(0), "Registration of publisher introduced ghost methods."); this.testee.Register(testSubscriber); Assert.AreEqual(methodCount, testSubscriber.GetType().GetMethods().GetLength(0), "Registration of subscriber introduced ghost methods."); testPublisher.DoStuff(); Assert.AreEqual(methodCount, testSubscriber.GetType().GetMethods().GetLength(0), "Calling handler method introduced ghost methods."); Assert.AreEqual(6, testSubscriber.MyValue); }
public void Setup() { _target = new EventBroker (); }