Esempio n. 1
0
        public async stt::Task CreateWriteStreamRequestObjectAsync()
        {
            moq::Mock <BigQueryWrite.BigQueryWriteClient> mockGrpcClient = new moq::Mock <BigQueryWrite.BigQueryWriteClient>(moq::MockBehavior.Strict);
            CreateWriteStreamRequest request = new CreateWriteStreamRequest
            {
                ParentAsTableName = TableName.FromProjectDatasetTable("[PROJECT]", "[DATASET]", "[TABLE]"),
                WriteStream       = new WriteStream(),
            };
            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.CreateWriteStreamAsync(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.CreateWriteStreamAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void CreateWriteStream()
        {
            moq::Mock <BigQueryWrite.BigQueryWriteClient> mockGrpcClient = new moq::Mock <BigQueryWrite.BigQueryWriteClient>(moq::MockBehavior.Strict);
            CreateWriteStreamRequest request = new CreateWriteStreamRequest
            {
                ParentAsTableName = TableName.FromProjectDatasetTable("[PROJECT]", "[DATASET]", "[TABLE]"),
                WriteStream       = new WriteStream(),
            };
            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(),
                WriteMode       = WriteStream.Types.WriteMode.Unspecified,
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 3
0
        public void CreateReadSession()
        {
            moq::Mock <BigQueryRead.BigQueryReadClient> mockGrpcClient = new moq::Mock <BigQueryRead.BigQueryReadClient>(moq::MockBehavior.Strict);
            CreateReadSessionRequest request = new CreateReadSessionRequest
            {
                ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"),
                ReadSession         = new ReadSession(),
                MaxStreamCount      = 1813871107,
            };
            ReadSession expectedResponse = new ReadSession
            {
                ReadSessionName  = ReadSessionName.FromProjectLocationSession("[PROJECT]", "[LOCATION]", "[SESSION]"),
                ExpireTime       = new wkt::Timestamp(),
                DataFormat       = DataFormat.Arrow,
                AvroSchema       = new AvroSchema(),
                ArrowSchema      = new ArrowSchema(),
                TableAsTableName = TableName.FromProjectDatasetTable("[PROJECT]", "[DATASET]", "[TABLE]"),
                TableModifiers   = new ReadSession.Types.TableModifiers(),
                ReadOptions      = new ReadSession.Types.TableReadOptions(),
                Streams          = { new ReadStream(), },
            };

            mockGrpcClient.Setup(x => x.CreateReadSession(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            BigQueryReadClient client   = new BigQueryReadClientImpl(mockGrpcClient.Object, null);
            ReadSession        response = client.CreateReadSession(request.Parent, request.ReadSession, request.MaxStreamCount);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 4
0
        public async stt::Task CreateReadSessionRequestObjectAsync()
        {
            moq::Mock <BigQueryRead.BigQueryReadClient> mockGrpcClient = new moq::Mock <BigQueryRead.BigQueryReadClient>(moq::MockBehavior.Strict);
            CreateReadSessionRequest request = new CreateReadSessionRequest
            {
                ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"),
                ReadSession         = new ReadSession(),
                MaxStreamCount      = 1813871107,
            };
            ReadSession expectedResponse = new ReadSession
            {
                ReadSessionName  = ReadSessionName.FromProjectLocationSession("[PROJECT]", "[LOCATION]", "[SESSION]"),
                ExpireTime       = new wkt::Timestamp(),
                DataFormat       = DataFormat.Arrow,
                AvroSchema       = new AvroSchema(),
                ArrowSchema      = new ArrowSchema(),
                TableAsTableName = TableName.FromProjectDatasetTable("[PROJECT]", "[DATASET]", "[TABLE]"),
                TableModifiers   = new ReadSession.Types.TableModifiers(),
                ReadOptions      = new ReadSession.Types.TableReadOptions(),
                Streams          = { new ReadStream(), },
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            ReadSession responseCancellationToken = await client.CreateReadSessionAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for CreateWriteStream</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void CreateWriteStreamResourceNames()
 {
     // Create client
     BigQueryWriteClient bigQueryWriteClient = BigQueryWriteClient.Create();
     // Initialize request argument(s)
     TableName   parent      = TableName.FromProjectDatasetTable("[PROJECT]", "[DATASET]", "[TABLE]");
     WriteStream writeStream = new WriteStream();
     // Make the request
     WriteStream response = bigQueryWriteClient.CreateWriteStream(parent, writeStream);
 }
 /// <summary>Snippet for CreateWriteStream</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void CreateWriteStreamRequestObject()
 {
     // Create client
     BigQueryWriteClient bigQueryWriteClient = BigQueryWriteClient.Create();
     // Initialize request argument(s)
     CreateWriteStreamRequest request = new CreateWriteStreamRequest
     {
         ParentAsTableName = TableName.FromProjectDatasetTable("[PROJECT]", "[DATASET]", "[TABLE]"),
         WriteStream       = new WriteStream(),
     };
     // Make the request
     WriteStream response = bigQueryWriteClient.CreateWriteStream(request);
 }
        /// <summary>Snippet for CreateWriteStreamAsync</summary>
        public async Task CreateWriteStreamResourceNamesAsync()
        {
            // Snippet: CreateWriteStreamAsync(TableName, WriteStream, CallSettings)
            // Additional: CreateWriteStreamAsync(TableName, WriteStream, CancellationToken)
            // Create client
            BigQueryWriteClient bigQueryWriteClient = await BigQueryWriteClient.CreateAsync();

            // Initialize request argument(s)
            TableName   parent      = TableName.FromProjectDatasetTable("[PROJECT]", "[DATASET]", "[TABLE]");
            WriteStream writeStream = new WriteStream();
            // Make the request
            WriteStream response = await bigQueryWriteClient.CreateWriteStreamAsync(parent, writeStream);

            // End snippet
        }
        /// <summary>Snippet for CreateWriteStreamAsync</summary>
        public async Task CreateWriteStreamRequestObjectAsync()
        {
            // Snippet: CreateWriteStreamAsync(CreateWriteStreamRequest, CallSettings)
            // Additional: CreateWriteStreamAsync(CreateWriteStreamRequest, CancellationToken)
            // Create client
            BigQueryWriteClient bigQueryWriteClient = await BigQueryWriteClient.CreateAsync();

            // Initialize request argument(s)
            CreateWriteStreamRequest request = new CreateWriteStreamRequest
            {
                ParentAsTableName = TableName.FromProjectDatasetTable("[PROJECT]", "[DATASET]", "[TABLE]"),
                WriteStream       = new WriteStream(),
            };
            // Make the request
            WriteStream response = await bigQueryWriteClient.CreateWriteStreamAsync(request);

            // End snippet
        }