Пример #1
0
        public async Task Test_Create_Add_Delete_PostLogoutRedirectUris_ByClientIdAsync()
        {
            var adminStore = new IdentityServer3AdminStore();
            var insert     = await CassandraTestHelper.InsertTestData_Clients(1);

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

            Assert.IsNotNull(result);
            var original = result.PostLogoutRedirectUris;

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

            List <string> newData = new List <string>()
            {
                Guid.NewGuid().ToString()
            };

            await adminStore.AddPostLogoutRedirectUrisToClientAsync(insert[0].ClientId, newData);

            var finalList = new List <string>();

            finalList.AddRange(original);
            finalList.AddRange(newData);

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

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


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

            Assert.IsFalse(ff.Any());


            await adminStore.DeletePostLogoutRedirectUrisFromClientAsync(insert[0].ClientId, result.PostLogoutRedirectUris);

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

            Assert.IsNotNull(result);

            Assert.IsFalse(result.PostLogoutRedirectUris.Any());
        }