public async Task TestStoreAsync()
        {
            try
            {
                var subjectSeed = Guid.NewGuid().ToString();
                var th          = MakeTokenHandle(subjectSeed, 0);
                TokenHandleRecord tokenHandleRecord = new TokenHandleRecord(th);
                Guid id = tokenHandleRecord.Id;

                var key    = th.Key;
                var result = await _tokenHandleStore.GetAsync(key);

                Assert.IsNull(result);



                Token token = await th.MakeIdentityServerTokenAsync(_clientStore);

                await _tokenHandleStore.StoreAsync(key, token);

                result = await _tokenHandleStore.GetAsync(key);

                tokenHandleRecord = new TokenHandleRecord(new TokenHandle(key, result));

                Assert.AreEqual(tokenHandleRecord.Id, id);
            }
            catch (Exception e)
            {
            }
        }
        public void TestCreateAsync()
        {
            var  insert            = InsertTestData(_clientStore, _scopeStore, _tokenHandleStore, 1);
            Guid id                = insert[0].Id;
            var  result            = _tokenHandleStore.RetrieveAsync(id);
            var  tokenHandleRecord = new TokenHandleRecord(result.Result);

            Assert.AreEqual(tokenHandleRecord.Id, id);
        }
        public static List <TokenHandleRecord> InsertTestData(ClientStore clientStore, ScopeStore scopeStore, TokenHandleStore store, int count = 1)
        {
            var subjectSeed  = Guid.NewGuid().ToString();
            var clientInsert = ClientStoreTest.InsertTestData(clientStore, scopeStore, 1);
            List <TokenHandleRecord> result = new List <TokenHandleRecord>();

            for (int i = 0; i < count; ++i)
            {
                var tokenHandle = MakeTokenHandle(subjectSeed, i);
                tokenHandle.ClientId = clientInsert[0].Record.ClientId;
                var tokenHandleRecord = new TokenHandleRecord(tokenHandle);
                store.CreateAsync(tokenHandleRecord.Record);
                result.Add(tokenHandleRecord);
            }
            return(result);
        }
        public void TestUpdateAsync()
        {
            var  insert            = InsertTestData(_clientStore, _scopeStore, _tokenHandleStore, 1);
            Guid id                = insert[0].Id;
            var  result            = _tokenHandleStore.RetrieveAsync(id);
            var  tokenHandleRecord = new TokenHandleRecord(result.Result);


            Assert.AreEqual(tokenHandleRecord.Id, id);

            var testValue = Guid.NewGuid().ToString();

            tokenHandleRecord.Record.Type = testValue;

            _tokenHandleStore.UpdateAsync(tokenHandleRecord.Record);
            result            = _tokenHandleStore.RetrieveAsync(id);
            tokenHandleRecord = new TokenHandleRecord(result.Result);
            Assert.AreEqual(tokenHandleRecord.Id, id);
            Assert.AreEqual(tokenHandleRecord.Record.Type, testValue);
        }