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); }
protected virtual async Task AddClaimTypeIfNotExistsAsync(string claimType) { if (await ClaimTypeRepository.AnyAsync(claimType)) { return; } await ClaimTypeRepository.InsertAsync( new IdentityClaimType( GuidGenerator.Create(), claimType, isStatic : true ) ); }