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 VerifyMatchesExpectedZeroVisits() { var proxy = Mock.Create <IUserService>(); proxy.Setup(p => p.Delete("Homer")); proxy.Setup(p => p.Delete("Marge")); var controller = new UserController(proxy); controller.Delete("Homer"); proxy.Verify(p => p.Delete("Marge"), Occurred.Never()); }
public void VerifyMatchesExpectedZeroVisits() { var proxy = Mock.Create <IUserService>(); proxy.Setup(p => p.Save("Bart")).Returns(true); proxy.Setup(p => p.Save("Marge")).Returns(false); var controller = new UserController(proxy); controller.Save("Bart"); proxy.Verify(p => p.Save("Marge"), Occurred.Never()); }