示例#1
0
		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");
		}
示例#2
0
        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");
        }
示例#3
0
		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);
		}
示例#4
0
        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);
        }
示例#5
0
		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);
		}
示例#6
0
        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);
        }