コード例 #1
0
        public async Task GqlQueryIsTransformedAsync()
        {
            var structured = new Query
            {
                Limit      = 10,
                Projection = { "foo", "bar" }
            };
            // No, this isn't real GQL. But it's an easy way of testing things.
            var gql = new GqlQuery {
                QueryString = structured.ToString()
            };
            var server   = new FakeServer(4);
            var streamer = new QueryStreamer(new RunQueryRequest {
                GqlQuery = gql
            }, server.CreateApiCall(), null);

            await AssertEntitiesAsync(streamer, 0, 10);

            var firstStructured = new Query(structured)
            {
                Limit = 6, StartCursor = ByteString.CopyFromUtf8("4")
            };

            Assert.Equal(firstStructured, server.Requests[1].Query);
        }
コード例 #2
0
        public void NoLimit()
        {
            var query = new Query {
                Offset = 5
            };
            var server   = new FakeServer(11);
            var streamer = new QueryStreamer(new RunQueryRequest {
                Query = query
            }, server.CreateApiCall(), null);

            AssertEntities(streamer, 5, 15);
            AssertLimits(server, null, null);
            AssertOffsets(server, 5, 0);
        }
コード例 #3
0
        public void LimitAndOffset()
        {
            var query = new Query
            {
                Limit  = 7,
                Offset = 5
            };
            var server   = new FakeServer(4);
            var streamer = new QueryStreamer(new RunQueryRequest {
                Query = query
            }, server.CreateApiCall(), null);

            AssertEntities(streamer, 5, 7);
            AssertLimits(server, 7, 7, 4);
            AssertOffsets(server, 5, 1, 0);
        }