Esempio n. 1
0
        public void LogOn_Sets_LastLogonDate_if_goes_as_expected()
        {
            var account = new Account("jdoe", new Password("secret"));
            var clock = MockRepository.GenerateStub<ISystemClock>();
            SystemContext.Clock = clock;

            var januariTheFirst2011 = new DateTime(2011, 1, 1);
            clock.Stub(c => c.Now()).Return(januariTheFirst2011);

            account.LogOn("secret");

            Assert.AreEqual(januariTheFirst2011, account.LastLogOnDate);
        }
Esempio n. 2
0
        public void LogOn_Throws_InactiveAccountException_if_account_is_inactive()
        {
            var account = new Account("jdoe", new Password("secret"));
            account.Deactivate();

            Assert.Throws<InactiveAccountException>(() => account.LogOn("secret"));
        }
Esempio n. 3
0
        public void LogOn_Returns_true_if_everything_is_ok()
        {
            var account = new Account("jdoe", new Password("secret"));

            Assert.IsTrue(account.LogOn("secret"));
        }
Esempio n. 4
0
        public void LogOn_Should_return_false_if_password_is_different()
        {
            var account = new Account("jdoe", new Password("secret"));

            Assert.IsFalse(account.LogOn("wrong"));
        }