public static IIdentityServerBuilder AddIntegrationTestConfiguration(this IIdentityServerBuilder builder)
        {
            builder.AddInMemoryClients(ClientSeedData.GetClients(SeedingType.IntegrationTest));
            builder.AddInMemoryApiResources(ApiResourceSeedData.GetApiResources(SeedingType.IntegrationTest));
            builder.AddInMemoryUsers(IdentityUserSeedData.GetIdentityUsers(SeedingType.IntegrationTest));
            builder.AddInMemoryRoles(RoleSeedData.GetIdentityRoles(SeedingType.IntegrationTest));
            builder.AddInMemoryUserRoles(IdentityUserRoleSeedData.GetIdentityUserRoles(SeedingType.IntegrationTest));
            builder.AddInMemoryIdentityResources(IdentityResourceSeedData.GetIdentityResources(SeedingType.IntegrationTest));

            builder.AddInMemoryPersistedGrants();

            return(builder);
        }
        /// <summary>
        /// Adds the identity resources.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="seedingType">Type of the seeding.</param>
        private static void AddIdentityResources(ConfigurationDbContext context,
                                                 SeedingType seedingType)
        {
            List <IdentityResource> identityResources = IdentityResourceSeedData.GetIdentityResources(seedingType);

            foreach (IdentityResource identityResource in identityResources)
            {
                Boolean foundResource = context.IdentityResources.Any(a => a.Name == identityResource.Name);

                if (!foundResource)
                {
                    context.IdentityResources.Add(identityResource.ToEntity());
                    context.SaveChanges();
                }
            }
        }