public void RaisedEventDoesNotInvokeDettachedSubjectHandler() { var proxy = Mock.Create <IThermostatService>(); proxy.Setup(p => p.SwitchOn()); // ReSharper disable once UnusedVariable var controller = new ThemostatController(proxy); proxy.Raise(p => p.Cold += null, new EventArgs()); proxy.Verify(p => p.SwitchOn(), Occurred.Never()); }
public void RaisedEventPassesParameters() { const int temp = 100; var proxy = Mock.Create <IThermostatService>(); proxy.Setup(p => p.ChangeTemp(temp)); // ReSharper disable once UnusedVariable var controller = new ThemostatController(proxy); proxy.Raise(p => p.TempChanged += null, new TempChangedEventArgs(temp)); proxy.Verify(p => p.ChangeTemp(temp), Occurred.Once()); }