Exemplo n.º 1
0
        public async Task Create_User_many_Factor()
        {
            var testUser = CreateTestUser();


            var createUserResult = await _userStore.CreateAsync(testUser, CancellationToken.None);

            createUserResult.ShouldNotBeNull();
            createUserResult.Succeeded.ShouldBeTrue();
            int nCount = 10;

            for (int i = 0; i < nCount; ++i)
            {
                var challengeFactor = CreateTestFactor();
                var identityResult  = await _multiFactorUserStore.AddToFactorAsync(
                    testUser, challengeFactor, CancellationToken.None);

                identityResult.ShouldNotBeNull();
                identityResult.Succeeded.ShouldBeTrue();

                var findResult = await _multiFactorUserStore.FindByIdAsync(challengeFactor.FactorId,
                                                                           CancellationToken.None);

                findResult.ShouldNotBeNull();
                findResult.FactorId.ShouldBe(challengeFactor.FactorId);
            }

            var factors = await _multiFactorUserStore.GetFactorsAsync(testUser, CancellationToken.None);

            factors.ShouldNotBeNull();
            factors.Count.ShouldBe(nCount);
            foreach (var factor in factors)
            {
                factor.ShouldNotBeNull();
                factor.Challenge.ShouldNotBeNull();
                factor.ChallengeResponseHash.ShouldNotBeNull();
                factor.FactorId.ShouldNotBeNull();
            }
        }
 public async Task OnGetAsync(string factorId)
 {
     FactorId = factorId;
     Factor   = await _multiFactorUserStore.FindByIdAsync(factorId, CancellationToken.None);
 }