public void CanSendSMSWhenUserRequestForgottenPasswordReminder() { smsSender.SendSMS(null, null); LastCall.Constraints(Is.Equal("1234"), Text.StartsWith("new password: "******"Should send sms"); mocks.ReplayAll(); LoginController controller = new LoginController(userRepository, smsSender); controller.ForgottenPassword("sally"); }
public void WillRecordFailuresOfSendingSMS() { smsSender.SendSMS(null, null); LastCall.IgnoreArguments().Throw(new WebException("blah")); mocks.ReplayAll(); LoginController controller = new LoginController(userRepository, smsSender); controller.ForgottenPassword("sally"); mocks.VerifyAll(); Assert.AreEqual(1, controller.FailuresToSendSms.Count); }
public void SendSmsThatTakesMoreThanSpecifiedTimeFlagsAnError() { smsSender.SendSMS(null, null); /* LastCall.IgnoreArguments().Do((SendSMSDelegate) delegate { Thread.Sleep(750); }); */ LastCall.IgnoreArguments(); mocks.ReplayAll(); LoginController controller = new LoginController(userRepository, smsSender); controller.MaxDurationForSendingSMS = TimeSpan.FromSeconds(-1); controller.ForgottenPassword("sally"); mocks.VerifyAll(); Assert.AreEqual(1, controller.SmsSendTookTooLong.Count); }
public void SendSmsThatTakesMoreThanSpecifiedTimeFlagsAnError() { smsSender.SendSMS(null, null); /* * LastCall.IgnoreArguments().Do((SendSMSDelegate) delegate * { * Thread.Sleep(750); * }); */ LastCall.IgnoreArguments(); mocks.ReplayAll(); LoginController controller = new LoginController(userRepository, smsSender); controller.MaxDurationForSendingSMS = TimeSpan.FromSeconds(-1); controller.ForgottenPassword("sally"); mocks.VerifyAll(); Assert.AreEqual(1, controller.SmsSendTookTooLong.Count); }