• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Accounts.MockUserAccountService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BrockAllen.MembershipReboot.Test.Services.Accounts.MockUserAccountService的典型用法代码示例。如果您正苦于以下问题:C# MockUserAccountService类的具体用法?C# MockUserAccountService怎么用?C# MockUserAccountService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MockUserAccountService类属于BrockAllen.MembershipReboot.Test.Services.Accounts命名空间,在下文中一共展示了MockUserAccountService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: 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:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:11,代码来源:UserAccountServiceTests.cs


示例2: MultiTenantNotEnabled_NullTenant_ReturnsResultsForDefaultTenant

 public void MultiTenantNotEnabled_NullTenant_ReturnsResultsForDefaultTenant()
 {
     SecuritySettings.Instance.MultiTenant = false;
     SecuritySettings.Instance.DefaultTenant = "a";
     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(2, result.Count());
 }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:12,代码来源:UserAccountServiceTests.cs


示例3: VerifyFails_DoesNotCallNotificationService

            public void VerifyFails_DoesNotCallNotificationService()
            {
                var sub = new MockUserAccountService();
                sub.NotificationService = new Mock<INotificationService>();
                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);

                sub.Object.VerifyAccount("key");

                sub.NotificationService.Verify(x => x.SendAccountVerified(It.IsAny<UserAccount>()), Times.Never());
            }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:12,代码来源:UserAccountServiceTests.cs


示例4: 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)));
 }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:7,代码来源:UserAccountServiceTests.cs


示例5: NoAccountFound_ReturnsFail

 public void NoAccountFound_ReturnsFail()
 {
     var sub = new MockUserAccountService();
     sub.Mock.Setup(x => x.GetByUsername(It.IsAny<string>(), It.IsAny<string>())).Returns((UserAccount)null);
     Assert.IsFalse(sub.Object.Authenticate("user", "pass"));
 }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:6,代码来源:UserAccountServiceTests.cs


示例6: NullUsername_ReturnsFail

 public void NullUsername_ReturnsFail()
 {
     var sub = new MockUserAccountService();
     Assert.IsFalse(sub.Object.Authenticate(null, "pass"));
 }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:5,代码来源:UserAccountServiceTests.cs


示例7: NoTenantParam_LockoutParams_PassessNullTenant

 public void NoTenantParam_LockoutParams_PassessNullTenant()
 {
     var sub = new MockUserAccountService();
     sub.Object.Authenticate("user", "pass", 10, TimeSpan.FromDays(1));
     sub.Mock.Verify(x => x.Authenticate(null, "user", "pass", 10, TimeSpan.FromDays(1)));
 }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:6,代码来源:UserAccountServiceTests.cs


示例8: NoLockoutParams_PassessDefaultLocakoutParams

 public void NoLockoutParams_PassessDefaultLocakoutParams()
 {
     var sub = new MockUserAccountService();
     sub.Object.Authenticate("ten", "user", "pass");
     sub.Mock.Verify(x => x.Authenticate("ten", "user", "pass", SecuritySettings.Instance.AccountLockoutFailedLoginAttempts, SecuritySettings.Instance.AccountLockoutDuration));
 }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:6,代码来源:UserAccountServiceTests.cs


示例9: CallsSendAccountDelete

            public void CallsSendAccountDelete()
            {
                var sub = new MockUserAccountService();
                sub.NotificationService = new Mock<INotificationService>();
                var account = new UserAccount();
                sub.Object.DeleteAccount(account);

                sub.NotificationService.Verify(x => x.SendAccountDelete(account));
            }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:9,代码来源:UserAccountServiceTests.cs


示例10: NoTenantParam_PassesNullTenant

 public void NoTenantParam_PassesNullTenant()
 {
     var sub = new MockUserAccountService();
     sub.Object.DeleteAccount("user");
     sub.Mock.Verify(x => x.DeleteAccount(null, "user"));
 }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:6,代码来源:UserAccountServiceTests.cs


示例11: KeysMatch_DeleteAccountCalled

            public void KeysMatch_DeleteAccountCalled()
            {
                var sub = new MockUserAccountService();
                var account = new MockUserAccount();
                sub.Mock.Setup(x => x.GetByVerificationKey(It.IsAny<string>())).Returns(account.Object);
                account.Object.VerificationKey = "key";

                sub.Object.CancelNewAccount("key");

                sub.Mock.Verify(x => x.DeleteAccount(account.Object));
            }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:11,代码来源:UserAccountServiceTests.cs


示例12: KeysMatch_ReturnsTrue

            public void KeysMatch_ReturnsTrue()
            {
                var sub = new MockUserAccountService();
                var account = new MockUserAccount();
                sub.Mock.Setup(x => x.GetByVerificationKey(It.IsAny<string>())).Returns(account.Object);
                account.Object.VerificationKey = "key";

                Assert.IsTrue(sub.Object.CancelNewAccount("key"));
            }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:9,代码来源:UserAccountServiceTests.cs


示例13: 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:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:9,代码来源:UserAccountServiceTests.cs


示例14: 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:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:6,代码来源:UserAccountServiceTests.cs


示例15: VerifySucceeds_CallsNotificationService

            public void VerifySucceeds_CallsNotificationService()
            {
                var sub = new MockUserAccountService();
                sub.NotificationService = new Mock<INotificationService>();
                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(true);

                sub.Object.VerifyAccount("key");

                sub.NotificationService.Verify(x => x.SendAccountVerified(account.Object));
            }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:12,代码来源:UserAccountServiceTests.cs


示例16: 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());
            }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:13,代码来源:UserAccountServiceTests.cs


示例17: CallsSaveChangesOnRepo

            public void CallsSaveChangesOnRepo()
            {
                var sub = new MockUserAccountService();
                var account = new UserAccount();
                sub.Object.DeleteAccount(account);

                sub.UserAccountRepository.Verify(x => x.SaveChanges());
            }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:8,代码来源:UserAccountServiceTests.cs


示例18: MultiTenantEnabled_NullTenantParam_ReturnsFail

            public void MultiTenantEnabled_NullTenantParam_ReturnsFail()
            {
                SecuritySettings.Instance.MultiTenant = true;

                var sub = new MockUserAccountService();
                var result = sub.Object.DeleteAccount(null, "user");
                Assert.IsFalse(result);
            }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:8,代码来源:UserAccountServiceTests.cs


示例19: NoTenantParam_PassesNullForTenant

 public void NoTenantParam_PassesNullForTenant()
 {
     var sub = new MockUserAccountService();
     sub.Object.Authenticate("user", "pass");
     sub.Mock.Verify(x => x.Authenticate(null, "user", "pass"));
 }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:6,代码来源:UserAccountServiceTests.cs


示例20: NullUsernameParam_ReturnsFail

 public void NullUsernameParam_ReturnsFail()
 {
     var sub = new MockUserAccountService();
     var result = sub.Object.DeleteAccount((string)null);
     Assert.IsFalse(result);
 }
开发者ID:rodmjay,项目名称:BrockAllen.MembershipReboot,代码行数:6,代码来源:UserAccountServiceTests.cs



注:本文中的BrockAllen.MembershipReboot.Test.Services.Accounts.MockUserAccountService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Brunet.Address类代码示例发布时间:2022-05-24
下一篇:
C# Accounts.MockUserAccountService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap