void CanAddEventHandlerWithLambdaExpression()
 {
     bool eventHasBeenRaised = false;
     var withEvents = new ClassWithEvents();
     withEvents.SomeEvent += (s, a) => eventHasBeenRaised = true;
     withEvents.DoWork();
     Assert.That(eventHasBeenRaised);
 }
 public void CanCallCustomEventHandler()
 {
     bool eventHasBeenRaised = false;
     var withEvents = new ClassWithEvents();
     withEvents.CustomEvent += (s, a) => eventHasBeenRaised = true;
     withEvents.DoCustomWork(new CustomEventArgs("a custom message"));
     Assert.That(eventHasBeenRaised);
 }
 public void CanUnsubsribeFromEvent()
 {
     var withEvents = new ClassWithEvents();
     withEvents.SomeEvent += SomeEvent;
     withEvents.DoWork();
     Assert.That(_eventHasBeenRaised);
     _eventHasBeenRaised = false;
     withEvents.SomeEvent -= SomeEvent;
     withEvents.DoWork();
     Assert.That(!_eventHasBeenRaised);
 }