public void CanSubscribeToEvent() { bool triggered = false; StubFiber stub = new StubFiber(); EventTester evt = new EventTester(); IDisposable dispose = stub.SubscribeToEvent(evt, "Event", () => triggered = true); Assert.IsTrue(evt.IsAttached); evt.Invoke(); Assert.IsTrue(triggered); dispose.Dispose(); Assert.IsFalse(evt.IsAttached); }
public void CanSubscribeToEvent() { bool triggered = false; var stub = StubFiber.StartNew(); var evt = new EventTester(); var dispose = stub.SubscribeToEvent <object>(evt, "Event", x => triggered = true); Assert.IsTrue(evt.IsAttached); evt.Invoke(); Assert.IsTrue(triggered); dispose.Dispose(); Assert.IsFalse(evt.IsAttached); }