public void ShouldRaiseLowFuel_WithoutNSub() { var fuelManagement = new FuelManagement(); var eventWasRaised = false; fuelManagement.LowFuelDetected += (o, e) => eventWasRaised = true; fuelManagement.DoSomething(); Assert.That(eventWasRaised); }
public void ShouldRaiseLowFuel() { var fuelManagement = new FuelManagement(); var handler = Substitute.For <EventHandler <LowFuelWarningEventArgs> >(); fuelManagement.LowFuelDetected += handler; fuelManagement.DoSomething(); handler .Received() .Invoke(fuelManagement, Arg.Is <LowFuelWarningEventArgs>(x => x.PercentLeft < 20)); }