コード例 #1
0
        public async stt::Task GetWriteStreamResourceNamesAsync()
        {
            moq::Mock <BigQueryWrite.BigQueryWriteClient> mockGrpcClient = new moq::Mock <BigQueryWrite.BigQueryWriteClient>(moq::MockBehavior.Strict);
            GetWriteStreamRequest request = new GetWriteStreamRequest
            {
                WriteStreamName = WriteStreamName.FromProjectDatasetTableStream("[PROJECT]", "[DATASET]", "[TABLE]", "[STREAM]"),
            };
            WriteStream expectedResponse = new WriteStream
            {
                WriteStreamName = WriteStreamName.FromProjectDatasetTableStream("[PROJECT]", "[DATASET]", "[TABLE]", "[STREAM]"),
                Type            = WriteStream.Types.Type.Buffered,
                CreateTime      = new wkt::Timestamp(),
                CommitTime      = new wkt::Timestamp(),
                TableSchema     = new TableSchema(),
            };

            mockGrpcClient.Setup(x => x.GetWriteStreamAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <WriteStream>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            BigQueryWriteClient client = new BigQueryWriteClientImpl(mockGrpcClient.Object, null);
            WriteStream         responseCallSettings = await client.GetWriteStreamAsync(request.WriteStreamName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            WriteStream responseCancellationToken = await client.GetWriteStreamAsync(request.WriteStreamName, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for GetWriteStream</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetWriteStreamRequestObject()
 {
     // Create client
     BigQueryWriteClient bigQueryWriteClient = BigQueryWriteClient.Create();
     // Initialize request argument(s)
     GetWriteStreamRequest request = new GetWriteStreamRequest
     {
         WriteStreamName = WriteStreamName.FromProjectDatasetTableStream("[PROJECT]", "[DATASET]", "[TABLE]", "[STREAM]"),
     };
     // Make the request
     WriteStream response = bigQueryWriteClient.GetWriteStream(request);
 }
コード例 #3
0
        /// <summary>Snippet for GetWriteStreamAsync</summary>
        public async Task GetWriteStreamRequestObjectAsync()
        {
            // Snippet: GetWriteStreamAsync(GetWriteStreamRequest, CallSettings)
            // Additional: GetWriteStreamAsync(GetWriteStreamRequest, CancellationToken)
            // Create client
            BigQueryWriteClient bigQueryWriteClient = await BigQueryWriteClient.CreateAsync();

            // Initialize request argument(s)
            GetWriteStreamRequest request = new GetWriteStreamRequest
            {
                WriteStreamName = WriteStreamName.FromProjectDatasetTableStream("[PROJECT]", "[DATASET]", "[TABLE]", "[STREAM]"),
            };
            // Make the request
            WriteStream response = await bigQueryWriteClient.GetWriteStreamAsync(request);

            // End snippet
        }
コード例 #4
0
        public void GetWriteStreamResourceNames()
        {
            moq::Mock <BigQueryWrite.BigQueryWriteClient> mockGrpcClient = new moq::Mock <BigQueryWrite.BigQueryWriteClient>(moq::MockBehavior.Strict);
            GetWriteStreamRequest request = new GetWriteStreamRequest
            {
                WriteStreamName = WriteStreamName.FromProjectDatasetTableStream("[PROJECT]", "[DATASET]", "[TABLE]", "[STREAM]"),
            };
            WriteStream expectedResponse = new WriteStream
            {
                WriteStreamName = WriteStreamName.FromProjectDatasetTableStream("[PROJECT]", "[DATASET]", "[TABLE]", "[STREAM]"),
                Type            = WriteStream.Types.Type.Buffered,
                CreateTime      = new wkt::Timestamp(),
                CommitTime      = new wkt::Timestamp(),
                TableSchema     = new TableSchema(),
            };

            mockGrpcClient.Setup(x => x.GetWriteStream(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            BigQueryWriteClient client   = new BigQueryWriteClientImpl(mockGrpcClient.Object, null);
            WriteStream         response = client.GetWriteStream(request.WriteStreamName);

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