Exemplo n.º 1
0
        public async Task Should_Check_Name_If_It_Is_Uniquee()
        {
            var claim = (await ClaimTypeRepository.GetListAsync()).FirstOrDefault();

            var result1 = await ClaimTypeRepository.AnyAsync(claim.Name).ConfigureAwait(false);

            result1.ShouldBe(true);

            var result2 = await ClaimTypeRepository.AnyAsync(Guid.NewGuid().ToString()).ConfigureAwait(false);

            result2.ShouldBe(false);
        }
Exemplo n.º 2
0
    protected virtual async Task AddClaimTypeIfNotExistsAsync(string claimType)
    {
        if (await ClaimTypeRepository.AnyAsync(claimType))
        {
            return;
        }

        await ClaimTypeRepository.InsertAsync(
            new IdentityClaimType(
                GuidGenerator.Create(),
                claimType,
                isStatic : true
                )
            );
    }