当前位置: 首页>>代码示例>>C#>>正文


C# MockUserAccountService.MockUserAccounts方法代码示例

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


在下文中一共展示了MockUserAccountService.MockUserAccounts方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例3: ValidKey_MultipleMatches_Throws

 public void ValidKey_MultipleMatches_Throws()
 {
     var sub = new MockUserAccountService();
     sub.MockUserAccounts(
         new UserAccount { ID = a, VerificationKey = "a" },
         new UserAccount { ID = b, VerificationKey = "b" },
         new UserAccount { ID = c, VerificationKey = "b" });
     var result = sub.Object.GetByVerificationKey("b");
 }
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:9,代码来源:UserAccountServiceTests.cs

示例4: ValidKey_ReturnsCorrectResult

 public void ValidKey_ReturnsCorrectResult()
 {
     var sub = new MockUserAccountService();
     sub.MockUserAccounts(
         new UserAccount { ID = a, VerificationKey = "a" },
         new UserAccount { ID = b, VerificationKey = "b" },
         new UserAccount { ID = c, VerificationKey = "c" });
     var result = sub.Object.GetByVerificationKey("b");
     Assert.AreEqual(b, result.ID);
 }
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:10,代码来源:UserAccountServiceTests.cs

示例5: PassInvalidEmail_ReturnsNull

 public void PassInvalidEmail_ReturnsNull()
 {
     var sub = new MockUserAccountService();
     sub.MockUserAccounts(
         new UserAccount { ID = a, Tenant = sub.SecuritySettings.DefaultTenant, Email = "a" },
         new UserAccount { ID = b, Tenant = sub.SecuritySettings.DefaultTenant, Email = "b" },
         new UserAccount { ID = c, Tenant = sub.SecuritySettings.DefaultTenant, Email = "c" });
     var result = sub.Object.GetByEmail("d");
     Assert.IsNull(result);
 }
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:10,代码来源:UserAccountServiceTests.cs

示例6: PassValidEmail_MultipleMatches_Throws

 public void PassValidEmail_MultipleMatches_Throws()
 {
     var sub = new MockUserAccountService();
     sub.MockUserAccounts(
         new UserAccount { ID = a, Tenant = sub.SecuritySettings.DefaultTenant, Email = "a" },
         new UserAccount { ID = b, Tenant = sub.SecuritySettings.DefaultTenant, Email = "a" },
         new UserAccount { ID = c, Tenant = sub.SecuritySettings.DefaultTenant, Email = "c" });
     sub.Object.GetByEmail("a");
 }
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:9,代码来源:UserAccountServiceTests.cs

示例7: PassValidUsername_MultipleMatches_Throws

 public void PassValidUsername_MultipleMatches_Throws()
 {
     var sub = new MockUserAccountService();
     sub.MockUserAccounts(
         new UserAccount { ID = a, Tenant = SecuritySettings.Instance.DefaultTenant, Username = "a" },
         new UserAccount { ID = b, Tenant = SecuritySettings.Instance.DefaultTenant, Username = "a" },
         new UserAccount { ID = c, Tenant = SecuritySettings.Instance.DefaultTenant, Username = "c" });
     sub.Object.GetByUsername("a");
 }
开发者ID:keizof,项目名称:BrockAllen.MembershipReboot,代码行数:9,代码来源:UserAccountServiceTests.cs

示例8: MultiTenantNotEnabled_ReturnsCorrectValues

            public void MultiTenantNotEnabled_ReturnsCorrectValues()
            {
                var sub = new MockUserAccountService();
                sub.MockUserAccounts(
                    new UserAccount { ID = a, Tenant = sub.SecuritySettings.DefaultTenant, Email = "a" },
                    new UserAccount { ID = b, Tenant = sub.SecuritySettings.DefaultTenant, Email = "b" },
                    new UserAccount { ID = c, Tenant = "t2", Email = "a" });

                Assert.IsTrue(sub.Object.EmailExists("a"));
                Assert.IsTrue(sub.Object.EmailExists("b"));
                Assert.IsTrue(sub.Object.EmailExists(sub.SecuritySettings.DefaultTenant, "a"));
                Assert.IsTrue(sub.Object.EmailExists("t1", "b"));
                Assert.IsTrue(sub.Object.EmailExists("t2", "a"));

                Assert.IsFalse(sub.Object.EmailExists("c"));
                Assert.IsFalse(sub.Object.EmailExists("t2", "c"));
            }
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:17,代码来源:UserAccountServiceTests.cs

示例9: MultiTenantEnabled_NullTenant_ReturnsEmptyResults

 public void MultiTenantEnabled_NullTenant_ReturnsEmptyResults()
 {
     var sub = new MockUserAccountService();
     sub.SecuritySettings.MultiTenant = true;
     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:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:11,代码来源:UserAccountServiceTests.cs

示例10: ValidAccount_CallsAccount

 public void ValidAccount_CallsAccount()
 {
     var sub = new MockUserAccountService();
     sub.SecuritySettings.DefaultTenant = "tenant";
     var account = new MockUserAccount("tenant", "user", "pass", "[email protected]");
     sub.MockUserAccounts(account.Object);
     var result = sub.Object.IsPasswordExpired("tenant", "user");
     account.Verify(x => x.GetIsPasswordExpired(It.IsAny<int>()));
 }
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:9,代码来源:UserAccountServiceTests.cs

示例11: ValidUser_RepositorySaved

 public void ValidUser_RepositorySaved()
 {
     var sub = new MockUserAccountService();
     var user = new MockUserAccount(sub.SecuritySettings.DefaultTenant, "user", "foo", "[email protected]");
     sub.MockUserAccounts(user.Object);
     sub.Object.SetPassword("user", "pass");
     sub.UserAccountRepository.Verify(x => x.Update(user.Object));
 }
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:8,代码来源:UserAccountServiceTests.cs

示例12: ValidUser_SetPasswordCalled

 public void ValidUser_SetPasswordCalled()
 {
     var sub = new MockUserAccountService();
     var user = new MockUserAccount(sub.SecuritySettings.DefaultTenant, "user", "foo", "[email protected]");
     sub.MockUserAccounts(user.Object);
     sub.Object.SetPassword("user", "pass");
     user.Verify(x => x.SetPassword("pass"));
 }
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:8,代码来源:UserAccountServiceTests.cs

示例13: NoUser_Throws

 public void NoUser_Throws()
 {
     var sub = new MockUserAccountService();
     sub.MockUserAccounts(new UserAccount { Tenant = "tenant", Username = "user" });
     sub.Object.SetPassword("tenant", "user2", "pass");
 }
开发者ID:kijanawoodard,项目名称:BrockAllen.MembershipReboot,代码行数:6,代码来源:UserAccountServiceTests.cs

示例14: UsernamesUniqueAcrossTenants_CorrectResultsReturned

            public void UsernamesUniqueAcrossTenants_CorrectResultsReturned()
            {
                SecuritySettings.Instance.MultiTenant = true;
                SecuritySettings.Instance.UsernamesUniqueAcrossTenants = true;
                var sub = new MockUserAccountService();
                sub.MockUserAccounts(
                    new UserAccount { ID = a, Tenant = "t1", Username = "a" },
                    new UserAccount { ID = b, Tenant = "t1", Username = "b" },
                    new UserAccount { ID = c, Tenant = "t2", Username = "c" });
                Assert.IsTrue(sub.Object.UsernameExists("a"));
                Assert.IsTrue(sub.Object.UsernameExists("t1", "a"));
                Assert.IsTrue(sub.Object.UsernameExists("t2", "a"));
                Assert.IsTrue(sub.Object.UsernameExists("t3", "a"));

                Assert.IsFalse(sub.Object.UsernameExists("d"));
                Assert.IsFalse(sub.Object.UsernameExists("t1", "d"));
                Assert.IsFalse(sub.Object.UsernameExists("t2", "d"));
                Assert.IsFalse(sub.Object.UsernameExists("t3", "d"));
            }
开发者ID:keizof,项目名称:BrockAllen.MembershipReboot,代码行数:19,代码来源:UserAccountServiceTests.cs

示例15: PassInvalidUsername_ReturnsNull

 public void PassInvalidUsername_ReturnsNull()
 {
     var sub = new MockUserAccountService();
     sub.MockUserAccounts(
         new UserAccount { ID = a, Tenant = SecuritySettings.Instance.DefaultTenant, Username = "a" },
         new UserAccount { ID = b, Tenant = SecuritySettings.Instance.DefaultTenant, Username = "b" },
         new UserAccount { ID = c, Tenant = SecuritySettings.Instance.DefaultTenant, Username = "c" });
     var result = sub.Object.GetByUsername("d");
     Assert.IsNull(result);
 }
开发者ID:keizof,项目名称:BrockAllen.MembershipReboot,代码行数:10,代码来源:UserAccountServiceTests.cs


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