public async Task Test_Create_Add_ScopeClaimsAsync() { var insertResult = await CassandraTestHelper.InsertTestData_Scopes(1); var queryNames = from item in insertResult select item.Record.Name; var nameList = queryNames.ToList(); var adminStore = new IdentityServer3AdminStore(); var stored = await adminStore.FindScopesAsync(nameList); Assert.AreEqual(stored.Count(), insertResult.Count); var scopeClaimComparer = ScopeClaimComparer.MinimalScopeClaimComparer; var scopeComparer = ScopeComparer.OrdinalIgnoreCase; var scope = await insertResult[0].Record.MakeIdentityServerScopeAsync(); var storedScope = stored.FirstOrDefault(); Assert.IsTrue(scopeComparer.Equals(scope, storedScope)); List <ScopeClaim> claims = new List <ScopeClaim>(); for (int i = 0; i < 2; ++i) { claims.Add(new ScopeClaim { Name = Guid.NewGuid().ToString(), AlwaysIncludeInIdToken = true, Description = Guid.NewGuid().ToString() }); } List <ScopeClaim> expected = storedScope.Claims.Union(claims, ScopeClaimComparer.MinimalScopeClaimComparer).ToList(); await adminStore.AddScopeClaimsAsync(insertResult[0].Record.Name, claims); stored = await adminStore.FindScopesAsync(nameList); storedScope = stored.FirstOrDefault(); Assert.IsTrue(scopeComparer.Equals(scope, storedScope)); var query = from item in storedScope.Claims where !expected.Contains(item, scopeClaimComparer) select item; var finalList = query.ToList(); Assert.IsTrue(finalList.Count == 0); }