本文整理匯總了C#中Account.LogOn方法的典型用法代碼示例。如果您正苦於以下問題:C# Account.LogOn方法的具體用法?C# Account.LogOn怎麽用?C# Account.LogOn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Account
的用法示例。
在下文中一共展示了Account.LogOn方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: LogOn_Sets_LastLogonDate_if_goes_as_expected
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);
}
示例2: LogOn_Throws_InactiveAccountException_if_account_is_inactive
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"));
}
示例3: LogOn_Returns_true_if_everything_is_ok
public void LogOn_Returns_true_if_everything_is_ok()
{
var account = new Account("jdoe", new Password("secret"));
Assert.IsTrue(account.LogOn("secret"));
}
示例4: LogOn_Should_return_false_if_password_is_different
public void LogOn_Should_return_false_if_password_is_different()
{
var account = new Account("jdoe", new Password("secret"));
Assert.IsFalse(account.LogOn("wrong"));
}