示例#1
0
 /// <summary>Snippet for PartitionQuery</summary>
 public void PartitionQuery_RequestObject()
 {
     // Snippet: PartitionQuery(PartitionQueryRequest,CallSettings)
     // Create client
     SpannerClient spannerClient = SpannerClient.Create();
     // Initialize request argument(s)
     PartitionQueryRequest request = new PartitionQueryRequest
     {
         Session = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]").ToString(),
         Sql     = "",
     };
     // Make the request
     PartitionResponse response = spannerClient.PartitionQuery(request);
     // End snippet
 }
示例#2
0
 /// <summary>Snippet for PartitionRead</summary>
 public void PartitionRead_RequestObject()
 {
     // Snippet: PartitionRead(PartitionReadRequest,CallSettings)
     // Create client
     SpannerClient spannerClient = SpannerClient.Create();
     // Initialize request argument(s)
     PartitionReadRequest request = new PartitionReadRequest
     {
         SessionAsSessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"),
         Table  = "",
         KeySet = new KeySet(),
     };
     // Make the request
     PartitionResponse response = spannerClient.PartitionRead(request);
     // End snippet
 }
示例#3
0
        /// <summary>Snippet for PartitionQueryAsync</summary>
        public async Task PartitionQueryAsync_RequestObject()
        {
            // Snippet: PartitionQueryAsync(PartitionQueryRequest,CallSettings)
            // Additional: PartitionQueryAsync(PartitionQueryRequest,CancellationToken)
            // Create client
            SpannerClient spannerClient = await SpannerClient.CreateAsync();

            // Initialize request argument(s)
            PartitionQueryRequest request = new PartitionQueryRequest
            {
                Session = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]").ToString(),
                Sql     = "",
            };
            // Make the request
            PartitionResponse response = await spannerClient.PartitionQueryAsync(request);

            // End snippet
        }
示例#4
0
        public async Task PartitionQueryAsync()
        {
            Mock <Spanner.SpannerClient> mockGrpcClient = new Mock <Spanner.SpannerClient>(MockBehavior.Strict);
            PartitionQueryRequest        request        = new PartitionQueryRequest
            {
                Session = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]").ToString(),
                Sql     = "sql114126",
            };
            PartitionResponse expectedResponse = new PartitionResponse();

            mockGrpcClient.Setup(x => x.PartitionQueryAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <PartitionResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            SpannerClient     client   = new SpannerClientImpl(mockGrpcClient.Object, null);
            PartitionResponse response = await client.PartitionQueryAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#5
0
        public void PartitionQuery()
        {
            Mock <Spanner.SpannerClient> mockGrpcClient = new Mock <Spanner.SpannerClient>(MockBehavior.Strict);
            PartitionQueryRequest        request        = new PartitionQueryRequest
            {
                Session = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]").ToString(),
                Sql     = "sql114126",
            };
            PartitionResponse expectedResponse = new PartitionResponse();

            mockGrpcClient.Setup(x => x.PartitionQuery(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            SpannerClient     client   = new SpannerClientImpl(mockGrpcClient.Object, null);
            PartitionResponse response = client.PartitionQuery(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#6
0
        public void PartitionRead()
        {
            Mock <Spanner.SpannerClient> mockGrpcClient = new Mock <Spanner.SpannerClient>(MockBehavior.Strict);
            PartitionReadRequest         request        = new PartitionReadRequest
            {
                SessionAsSessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"),
                Table  = "table110115790",
                KeySet = new KeySet(),
            };
            PartitionResponse expectedResponse = new PartitionResponse();

            mockGrpcClient.Setup(x => x.PartitionRead(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            SpannerClient     client   = new SpannerClientImpl(mockGrpcClient.Object, null);
            PartitionResponse response = client.PartitionRead(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }