public void TestGetStateByPartialCompositeKeyWithPagination()
        {
            QueryMetadata queryMetadata = new QueryMetadata {
                Bookmark = "aaaa", PageSize = 1
            };

            ChaincodeStub stub = PrepareStubAndMockHandler(true, queryMetadata.ToByteString());

            CompositeKey key = new CompositeKey("KEY");
            IQueryResultsEnumerable <IKeyValue> queryResultsIterator = stub.GetStateByPartialCompositeKeyWithPagination(key, 1, "aaaa");

            queryResultsIterator.First(); //Otherwise GetStateByRangeAsync will not be executed, that Or GetMetadata()
            handler.Verify(a => a.GetStateByRangeAsync("myc", "txId", "", key.ToString(), key.ToString() + "\udbff\udfff", queryMetadata.ToByteString(), It.IsAny <CancellationToken>()));
            Assert.AreEqual(queryResultsIterator.GetMetadata().FetchedRecordsCount, 2);
            Assert.AreEqual(queryResultsIterator.GetMetadata().Bookmark, "bbbb");


            key = new CompositeKey("");
            queryResultsIterator = stub.GetStateByPartialCompositeKeyWithPagination(key, 1, "aaaa");
            queryResultsIterator.First(); //Otherwise GetStateByRangeAsync will not be executed, that Or GetMetadata()

            handler.Verify(a => a.GetStateByRangeAsync("myc", "txId", "", key.ToString(), key.ToString() + "\udbff\udfff", queryMetadata.ToByteString(), It.IsAny <CancellationToken>()));
            Assert.AreEqual(queryResultsIterator.GetMetadata().FetchedRecordsCount, 2);
            Assert.AreEqual(queryResultsIterator.GetMetadata().Bookmark, "bbbb");
        }