本文整理汇总了C#中BrockAllen.MembershipReboot.Test.Accounts.MockUserAccountService类的典型用法代码示例。如果您正苦于以下问题:C# MockUserAccountService类的具体用法?C# MockUserAccountService怎么用?C# MockUserAccountService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MockUserAccountService类属于BrockAllen.MembershipReboot.Test.Accounts命名空间,在下文中一共展示了MockUserAccountService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: EmailIsValidFormat_ValidEmail_Succeeds
public void EmailIsValidFormat_ValidEmail_Succeeds()
{
var mockSvc = new MockUserAccountService();
var acct = new MockUserAccount();
var result = UserAccountValidation.EmailIsValidFormat.Validate(mockSvc.Object, acct.Object, "[email protected]");
Assert.IsNull(result);
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:7,代码来源:UserAccountValidationTests.cs
示例2: EmailIsValidFormat_InValidEmail_Fails
public void EmailIsValidFormat_InValidEmail_Fails()
{
var mockSvc = new MockUserAccountService();
var acct = new MockUserAccount();
var result = UserAccountValidation.EmailIsValidFormat.Validate(mockSvc.Object, acct.Object, "test");
Assert.IsNotNull(result);
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:7,代码来源:UserAccountValidationTests.cs
示例3: UsernameMustNotAlreadyExist_UsernameExistsInService_Fails
public void UsernameMustNotAlreadyExist_UsernameExistsInService_Fails()
{
var mockSvc = new MockUserAccountService();
var acct1 = new MockUserAccount(mockSvc.SecuritySettings.DefaultTenant, "u1", "p1", "[email protected]");
mockSvc.MockUserAccounts(acct1);
var acct2 = new MockUserAccount(mockSvc.SecuritySettings.DefaultTenant, "u1", "p1", "[email protected]");
var result = UserAccountValidation.UsernameMustNotAlreadyExist.Validate(mockSvc.Object, acct2.Object, acct2.Object.Username);
Assert.IsNotNull(result);
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:10,代码来源:UserAccountValidationTests.cs
示例4: EmailMustNotAlreadyExist_EmailDoesNotExistsInService_Succeeds
public void EmailMustNotAlreadyExist_EmailDoesNotExistsInService_Succeeds()
{
var mockSvc = new MockUserAccountService();
var acct1 = new MockUserAccount(mockSvc.SecuritySettings.DefaultTenant, "u1", "p1", "[email protected]");
mockSvc.MockUserAccounts(acct1);
var acct2 = new MockUserAccount(mockSvc.SecuritySettings.DefaultTenant, "u1", "p1", "[email protected]");
var result = UserAccountValidation.EmailMustNotAlreadyExist.Validate(mockSvc.Object, acct2.Object, acct2.Object.Email);
Assert.IsNull(result);
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:10,代码来源:UserAccountValidationTests.cs
示例5: MultiTenantEnabled_NullTenant_ReturnsEmptyResults
public void MultiTenantEnabled_NullTenant_ReturnsEmptyResults()
{
SecuritySettings.Instance.MultiTenant = true;
var sub = new MockUserAccountService();
sub.MockUserAccounts(
new UserAccount { Tenant = "a" },
new UserAccount { Tenant = "a" },
new UserAccount { Tenant = "b" });
var result = sub.Object.GetAll(null);
Assert.AreEqual(0, result.Count());
}
开发者ID:keizof,项目名称:BrockAllen.MembershipReboot,代码行数:11,代码来源:UserAccountServiceTests.cs
示例6: CallsAllValidators
public void CallsAllValidators()
{
bool wasCalled = false;
var sub = new MockUserAccountService();
sub.Configuration.RegisterUsernameValidator(
new DelegateValidator((svc, ua, val) =>
{
wasCalled = true;
return null;
}));
sub.Object.ValidateUsername(new MockUserAccount().Object, "foo");
Assert.IsTrue(wasCalled);
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:13,代码来源:UserAccountServiceTests.cs
示例7: AllowAccountDeletionDisabled_AccountIsNotVerified_CallsRemoveOnRepo
public void AllowAccountDeletionDisabled_AccountIsNotVerified_CallsRemoveOnRepo()
{
var sub = new MockUserAccountService();
sub.SecuritySettings.AllowAccountDeletion = false;
var account = new MockUserAccount();
account.Object.IsAccountVerified = false;
sub.Object.DeleteAccount(account.Object);
sub.UserAccountRepository.Verify(x => x.Remove(account.Object));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:11,代码来源:UserAccountServiceTests.cs
示例8: AllowAccountDeletion_CallsRemoveOnRepo
public void AllowAccountDeletion_CallsRemoveOnRepo()
{
var sub = new MockUserAccountService();
sub.SecuritySettings.AllowAccountDeletion = true;
var account = new MockUserAccount();
sub.Object.DeleteAccount(account.Object);
sub.UserAccountRepository.Verify(x => x.Remove(account.Object));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:10,代码来源:UserAccountServiceTests.cs
示例9: AccountFound_DeleteAccountCalled
public void AccountFound_DeleteAccountCalled()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
sub.Mock.Setup(x => x.GetByUsername(It.IsAny<string>(), It.IsAny<string>())).Returns(account.Object);
var result = sub.Object.DeleteAccount("user");
sub.Mock.Verify(x => x.DeleteAccount(account.Object));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:8,代码来源:UserAccountServiceTests.cs
示例10: VerifyAccountReturnsFalse_ReturnsFalse
public void VerifyAccountReturnsFalse_ReturnsFalse()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
sub.Mock.Setup(x => x.GetByVerificationKey(It.IsAny<string>())).Returns(account.Object);
account.Setup(x => x.VerifyAccount(It.IsAny<string>())).Returns(false);
Assert.IsFalse(sub.Object.VerifyAccount("key"));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:8,代码来源:UserAccountServiceTests.cs
示例11: ValidAccount_ReturnsAccount
public void ValidAccount_ReturnsAccount()
{
var sub = new MockUserAccountService();
var result = sub.Object.CreateAccount("user", "pass", "[email protected]");
Assert.IsNotNull(result);
Assert.AreEqual("user", result.Username);
Assert.AreEqual("[email protected]", result.Email);
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:8,代码来源:UserAccountServiceTests.cs
示例12: NullPassword_ReturnsFail
public void NullPassword_ReturnsFail()
{
var sub = new MockUserAccountService();
Assert.IsFalse(sub.Object.Authenticate("user", null));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:5,代码来源:UserAccountServiceTests.cs
示例13: MultiTenantEnabled_NullTenantParam_ReturnsFail
public void MultiTenantEnabled_NullTenantParam_ReturnsFail()
{
var sub = new MockUserAccountService();
sub.SecuritySettings.MultiTenant = true;
Assert.IsFalse(sub.Object.Authenticate(null, "user", "pass"));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:7,代码来源:UserAccountServiceTests.cs
示例14: NoTenantParam_PassesNullTenant
public void NoTenantParam_PassesNullTenant()
{
var sub = new MockUserAccountService();
sub.Object.DeleteAccount("user");
sub.Mock.Verify(x => x.DeleteAccount(null, "user"));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:6,代码来源:UserAccountServiceTests.cs
示例15: KeysMatch_DeleteAccountCalled
public void KeysMatch_DeleteAccountCalled()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
account.Object.VerificationPurpose = VerificationKeyPurpose.VerifyAccount;
sub.Mock.Setup(x => x.GetByVerificationKey(It.IsAny<string>())).Returns(account.Object);
account.Object.VerificationPurpose = VerificationKeyPurpose.VerifyAccount;
account.Object.VerificationKey = "key";
sub.Object.CancelNewAccount("key");
sub.Mock.Verify(x => x.DeleteAccount(account.Object));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:13,代码来源:UserAccountServiceTests.cs
示例16: ValidatorFailure_Throws
public void ValidatorFailure_Throws()
{
var mockVal = new Mock<IValidator>();
mockVal.Setup(x => x.Validate(It.IsAny<UserAccountService>(), It.IsAny<UserAccount>(), It.IsAny<String>())).Returns(new ValidationResult("error"));
var sub = new MockUserAccountService();
sub.Configuration.RegisterUsernameValidator(mockVal.Object);
sub.Object.ValidateUsername(new MockUserAccount().Object, "foo");
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:9,代码来源:UserAccountServiceTests.cs
示例17: KeysDontMatch_ReturnsFalse
public void KeysDontMatch_ReturnsFalse()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
account.Object.VerificationPurpose = VerificationKeyPurpose.VerifyAccount;
sub.Mock.Setup(x => x.GetByVerificationKey(It.IsAny<string>())).Returns(account.Object);
account.Object.VerificationKey = "key1";
Assert.IsFalse(sub.Object.CancelNewAccount("key2"));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:10,代码来源:UserAccountServiceTests.cs
示例18: AccountVerified_ReturnsFalse
public void AccountVerified_ReturnsFalse()
{
var sub = new MockUserAccountService();
var account = new MockUserAccount();
sub.Mock.Setup(x => x.GetByVerificationKey(It.IsAny<string>())).Returns(account.Object);
account.Object.IsAccountVerified = true;
Assert.IsFalse(sub.Object.CancelNewAccount("key"));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:9,代码来源:UserAccountServiceTests.cs
示例19: InvalidKey_ReturnsFalse
public void InvalidKey_ReturnsFalse()
{
var sub = new MockUserAccountService();
sub.Mock.Setup(x => x.GetByVerificationKey(It.IsAny<string>())).Returns((UserAccount)null);
Assert.IsFalse(sub.Object.CancelNewAccount("key"));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:6,代码来源:UserAccountServiceTests.cs
示例20: AllowAccountDeletionDisabled_AccountIsVerified_CallsCloseOnAccount
public void AllowAccountDeletionDisabled_AccountIsVerified_CallsCloseOnAccount()
{
var sub = new MockUserAccountService();
sub.SecuritySettings.AllowAccountDeletion = false;
var account = new MockUserAccount();
account.Object.IsLoginAllowed = true;
account.Object.IsAccountVerified = true;
sub.Object.DeleteAccount(account.Object);
sub.UserAccountRepository.Verify(x => x.Remove(It.IsAny<UserAccount>()), Times.Never());
account.Verify(x => x.CloseAccount());
sub.UserAccountRepository.Verify(x => x.Update(account.Object));
}
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:14,代码来源:UserAccountServiceTests.cs
注:本文中的BrockAllen.MembershipReboot.Test.Accounts.MockUserAccountService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论