Example #1
0
        public async Task Test_Create_Add_AllowedCustomGrantTypesByClientIdAsync()
        {
            var adminStore = new IdentityServer3AdminStore();
            var insert     = await CassandraTestHelper.InsertTestData_Clients(1);

            var result = await adminStore.FindClientByIdAsync(insert[0].ClientId);

            Assert.IsNotNull(result);

            var originalAllowedCustomGrantTypes = result.AllowedCustomGrantTypes;

            Assert.AreEqual(insert[0].ClientName, result.ClientName);

            List <string> newAllowedCustomGrantTypes = new List <string>()
            {
                Guid.NewGuid().ToString()
            };
            var finalList = new List <string>();

            finalList.AddRange(originalAllowedCustomGrantTypes);
            finalList.AddRange(newAllowedCustomGrantTypes);

            await adminStore.AddAllowedCustomGrantTypesToClientAsync(insert[0].ClientId, newAllowedCustomGrantTypes);


            result = await adminStore.FindClientByIdAsync(insert[0].ClientId);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.AllowedCustomGrantTypes.Count(), finalList.Count);


            var ff = result.AllowedCustomGrantTypes.Except(finalList);

            Assert.IsFalse(ff.Any());
        }