本文整理汇总了C#中MockUserAccount.Verify方法的典型用法代码示例。如果您正苦于以下问题:C# MockUserAccount.Verify方法的具体用法?C# MockUserAccount.Verify怎么用?C# MockUserAccount.Verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MockUserAccount
的用法示例。
在下文中一共展示了MockUserAccount.Verify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BasicProperties_Assigned
public void BasicProperties_Assigned()
{
var sub = new MockUserAccount("ten", "user", "pass", "email");
var now = new DateTime(2000, 2, 3, 8, 30, 0);
sub.Setup(x => x.UtcNow).Returns(now);
Assert.AreEqual("ten", sub.Object.Tenant);
Assert.AreEqual("user", sub.Object.Username);
Assert.AreEqual("email", sub.Object.Email);
Assert.AreEqual(now, sub.Object.Created);
sub.Verify(x => x.SetPassword("pass"));
}
示例2: CallsAuthenticateOnUserAccount
public void CallsAuthenticateOnUserAccount()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
sub.Object.Authenticate(account.Object, "pass", 10, TimeSpan.FromDays(1));
account.Verify(x => x.Authenticate("pass", 10, TimeSpan.FromDays(1)));
}
示例3: AllowAccountDeletionDisabled_AccountIsVerified_CallsCloseOnAccount
public void AllowAccountDeletionDisabled_AccountIsVerified_CallsCloseOnAccount()
{
SecuritySettings.Instance.AllowAccountDeletion = false;
var sub = new MockUserAccountService();
var account = new MockUserAccount();
account.Object.IsLoginAllowed = true;
account.Object.IsAccountVerified = true;
sub.Object.DeleteAccount(account.Object);
sub.UserAccountRepository.Verify(x => x.Remove(account.Object), Times.Never());
account.Verify(x => x.CloseAccount());
}
示例4: Success_CallsVerifyAccountOnUserAccountAndSaveOnRepository
public void Success_CallsVerifyAccountOnUserAccountAndSaveOnRepository()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
sub.Mock.Setup(x => x.GetByVerificationKey(It.IsAny<string>())).Returns(account.Object);
sub.Object.VerifyAccount("key");
account.Verify(x => x.VerifyAccount("key"));
sub.UserAccountRepository.Verify(x => x.SaveChanges());
}
示例5: UserAccountChangeEmailFromKeyCalled
public void UserAccountChangeEmailFromKeyCalled()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
sub.Mock.Setup(x => x.GetByVerificationKey(It.IsAny<string>())).Returns(account.Object);
sub.Mock.Setup(x => x.Authenticate(It.IsAny<UserAccount>(), It.IsAny<string>(), It.IsAny<int>(), It.IsAny<TimeSpan>())).Returns(true);
sub.Object.ChangeEmailFromKey("pass", "key", "[email protected]");
account.Verify(x => x.ChangeEmailFromKey("key", "[email protected]"));
}
示例6: AccountFound_CallsUserAccountChangeEmailRequest
public void AccountFound_CallsUserAccountChangeEmailRequest()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
sub.Mock.Setup(x => x.GetByUsername(It.IsAny<string>(), It.IsAny<string>())).Returns(account.Object);
sub.Object.ChangeEmailRequest("user", "[email protected]");
account.Verify(x => x.ChangeEmailRequest("[email protected]"));
}
示例7: ChangePasswordFromResetKeyCalledOnUserAccount
public void ChangePasswordFromResetKeyCalledOnUserAccount()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
sub.Mock.Setup(x => x.GetByVerificationKey(It.IsAny<string>())).Returns(account.Object);
sub.Object.ChangePasswordFromResetKey("key", "new");
account.Verify(x => x.ChangePasswordFromResetKey("key", "new"));
}
示例8: AccountVerified_UserAccountResetPasswordCalled
public void AccountVerified_UserAccountResetPasswordCalled()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
sub.Mock.Setup(x => x.GetByEmail(It.IsAny<string>(), It.IsAny<string>())).Returns(account.Object);
account.Object.IsAccountVerified = true;
sub.Object.ResetPassword("email");
account.Verify(x => x.ResetPassword());
}
示例9: AccountFound_CallsAccountChangePassword
public void AccountFound_CallsAccountChangePassword()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
sub.Mock.Setup(x => x.GetByUsername(It.IsAny<string>(), It.IsAny<string>())).Returns(account.Object);
sub.Object.ChangePassword("user", "old", "new");
account.Verify(x => x.ChangePassword("old", "new", It.IsAny<int>(), It.IsAny<TimeSpan>()));
}
示例10: ChangeSuccess_SetPasswordInvoked
public void ChangeSuccess_SetPasswordInvoked()
{
var subject = new MockUserAccount();
subject.Object.IsAccountVerified = true;
subject.Object.VerificationKey = "key";
subject.Setup(x => x.IsVerificationKeyStale).Returns(false);
var result = subject.Object.ChangePasswordFromResetKey("key", "new");
subject.Verify(x => x.SetPassword("new"));
}
示例11: SuccessfulChangePassword_SetsPassword
public void SuccessfulChangePassword_SetsPassword()
{
Mock<UserAccount> subject = new MockUserAccount();
subject
.Setup(x => x.Authenticate(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<TimeSpan>()))
.Returns(true);
var result = subject.Object.ChangePassword("old", "new", 0, TimeSpan.Zero);
subject.Verify(x => x.SetPassword("new"));
}
示例12: ValidAccount_CallsAccount
public void ValidAccount_CallsAccount()
{
SecuritySettings.Instance.DefaultTenant = "tenant";
var sub = new MockUserAccountService();
var account = new MockUserAccount("tenant", "user", "pass", "[email protected]");
sub.MockUserAccounts(account.Object);
var result = sub.Object.IsPasswordExpired("tenant", "user");
account.Verify(x => x.IsPasswordExpired);
}
示例13: ValidUser_SetPasswordCalled
public void ValidUser_SetPasswordCalled()
{
var sub = new MockUserAccountService();
var user = new MockUserAccount(SecuritySettings.Instance.DefaultTenant, "user", "foo", "[email protected]");
sub.MockUserAccounts(user.Object);
sub.Object.SetPassword("user", "pass");
user.Verify(x => x.SetPassword("pass"));
}
示例14: AccountFound_DoesNotSendAccountNameReminder
public void AccountFound_DoesNotSendAccountNameReminder()
{
var sub = new MockUserAccountService();
MockUserAccount account = new MockUserAccount();
sub.Mock.Setup(x => x.GetByEmail(It.IsAny<string>(), It.IsAny<string>())).Returns(account.Object);
sub.Object.SendUsernameReminder("email");
account.Verify(x => x.SendAccountNameReminder());
}
示例15: CallsAuthenticateOnUserAccount
public void CallsAuthenticateOnUserAccount()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
sub.Object.Authenticate(account.Object, "pass");
account.Verify(x => x.Authenticate("pass", It.IsAny<int>(), It.IsAny<TimeSpan>()));
}