コード例 #1
0
        public void Correctly_provides_feedback_to_the_user_when_email_address_is_not_specified()
        {
            IForgottenPasswordService service = new ForgottenPasswordService(null);
            string userFeedback = service.SendEmailTo(string.Empty, null);

            Assert.That(userFeedback, Is.EqualTo("Please enter the e-mail address to send your password to"));
        }
コード例 #2
0
        private void BtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            ForgottenPasswordService.ResetPassword(TbEmail.Text);
            MessageBox.Show("You got a new email");
            WindowLogin windowLogin = new WindowLogin();

            windowLogin.Show();
            this.Hide();
        }
コード例 #3
0
        public void Correctly_attempts_to_send_email_and_provide_feedback_when_email_cannot_be_sent()
        {
            MockRepository           mocks      = new MockRepository();
            IForgottenPasswordMailer mailer     = mocks.CreateMock <IForgottenPasswordMailer>();
            ISystemUserRepository    repository = mocks.CreateMock <ISystemUserRepository>();

            using (mocks.Record())
            {
                Expect.Call(mailer.SendForgottenPasswordEmail("*****@*****.**", repository)).Return(false);
            }

            using (mocks.Playback())
            {
                IForgottenPasswordService service = new ForgottenPasswordService(mailer);
                string userFeedback = service.SendEmailTo("*****@*****.**", repository);

                Assert.That(userFeedback, Is.EqualTo("We could not find a user with the e-mail address [email protected]"));
            }

            mocks.VerifyAll();
        }