예제 #1
0
        public void TestFindClientByIdAsync()
        {
            var insert = ClientStoreTest.InsertTestData(_clientStore, _scopeStore, 1);

            Guid id           = insert[0].Id;
            var  result       = _clientStore.FindClientByIdAsync(insert[0].Record.ClientId);
            var  clientRecord = new ClientRecord(result.Result.ToClientHandle());


            Assert.AreEqual(clientRecord.Id, id);
        }
예제 #2
0
        public void TestCreateAsync()
        {
            var insert = ClientStoreTest.InsertTestData(_clientStore, _scopeStore, 1);

            Guid id           = insert[0].Id;
            var  result       = _clientStore.RetrieveAsync(id);
            var  clientRecord = new ClientRecord(result.Result);


            Assert.AreEqual(clientRecord.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);
        }
예제 #4
0
        public void TestUpdateAsync()
        {
            var insert = ClientStoreTest.InsertTestData(_clientStore, _scopeStore, 1);

            Guid id = insert[0].Id;

            var result       = _clientStore.RetrieveAsync(id);
            var clientRecord = new ClientRecord(result.Result);


            Assert.AreEqual(clientRecord.Id, id);
            var testData = Guid.NewGuid().ToString();

            clientRecord.Record.ClientName = testData;
            _clientStore.UpdateAsync(clientRecord.Record);

            result       = _clientStore.RetrieveAsync(id);
            clientRecord = new ClientRecord(result.Result);


            Assert.AreEqual(clientRecord.Id, id);
            Assert.AreEqual(clientRecord.Record.ClientName, testData);
        }