public async stt::Task ReadModifyWriteRow2ResourceNamesAsync() { moq::Mock <Bigtable.BigtableClient> mockGrpcClient = new moq::Mock <Bigtable.BigtableClient>(moq::MockBehavior.Strict); ReadModifyWriteRowRequest request = new ReadModifyWriteRowRequest { TableNameAsTableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]"), RowKey = proto::ByteString.CopyFromUtf8("row_key7adfb7cb"), Rules = { new ReadModifyWriteRule(), }, AppProfileId = "app_profile_id57fb0442", }; ReadModifyWriteRowResponse expectedResponse = new ReadModifyWriteRowResponse { Row = new Row(), }; mockGrpcClient.Setup(x => x.ReadModifyWriteRowAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ReadModifyWriteRowResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); BigtableClient client = new BigtableClientImpl(mockGrpcClient.Object, null); ReadModifyWriteRowResponse responseCallSettings = await client.ReadModifyWriteRowAsync(request.TableNameAsTableName, request.RowKey, request.Rules, request.AppProfileId, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ReadModifyWriteRowResponse responseCancellationToken = await client.ReadModifyWriteRowAsync(request.TableNameAsTableName, request.RowKey, request.Rules, request.AppProfileId, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for ReadModifyWriteRow</summary> public void ReadModifyWriteRow_RequestObject() { // Snippet: ReadModifyWriteRow(ReadModifyWriteRowRequest,CallSettings) // Create client BigtableServiceApiClient bigtableServiceApiClient = BigtableServiceApiClient.Create(); // Initialize request argument(s) ReadModifyWriteRowRequest request = new ReadModifyWriteRowRequest { TableNameAsTableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"), RowKey = ByteString.Empty, Rules = { }, }; // Make the request ReadModifyWriteRowResponse response = bigtableServiceApiClient.ReadModifyWriteRow(request); // End snippet }
/// <summary>Snippet for ReadModifyWriteRowAsync</summary> public async Task ReadModifyWriteRowAsync_RequestObject() { // Snippet: ReadModifyWriteRowAsync(ReadModifyWriteRowRequest,CallSettings) // Additional: ReadModifyWriteRowAsync(ReadModifyWriteRowRequest,CancellationToken) // Create client BigtableServiceApiClient bigtableServiceApiClient = await BigtableServiceApiClient.CreateAsync(); // Initialize request argument(s) ReadModifyWriteRowRequest request = new ReadModifyWriteRowRequest { TableNameAsTableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"), RowKey = ByteString.Empty, Rules = { }, }; // Make the request ReadModifyWriteRowResponse response = await bigtableServiceApiClient.ReadModifyWriteRowAsync(request); // End snippet }
public async Task <IEnumerable <BigRow> > WriteRowAsync(string tableName, byte[] key, CancellationToken cancellationToken, IEnumerable <BigChange.FromRead> changes, Encoding encoding = null) { cancellationToken = cancellationToken == default(CancellationToken) ? CancellationToken.None : cancellationToken; encoding = encoding ?? BigModel.DefaultEncoding; var request = new ReadModifyWriteRowRequest { RowKey = key.ToByteString(), TableName = tableName.ToTableId(ClusterId), Rules = { changes.Select(change => change.AsApiObject()) } }; var response = await _client.ReadModifyWriteRowAsync(request, cancellationToken : cancellationToken); await Task.Yield(); return(response.Families.Select(row => new BigRow(tableName, encoding, row))); }
public async Task ReadModifyWriteRowAsync_RequestObject() { // Snippet: ReadModifyWriteRowAsync(ReadModifyWriteRowRequest,CallSettings) // Create client BigtableClient bigtableClient = await BigtableClient.CreateAsync(); // Initialize request argument(s) ReadModifyWriteRowRequest request = new ReadModifyWriteRowRequest { TableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString(), RowKey = ByteString.CopyFromUtf8(""), Rules = { }, }; // Make the request ReadModifyWriteRowResponse response = await bigtableClient.ReadModifyWriteRowAsync(request); // End snippet }
/// <summary>Snippet for ReadModifyWriteRow</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void ReadModifyWriteRowRequestObject() { // Create client BigtableClient bigtableClient = BigtableClient.Create(); // Initialize request argument(s) ReadModifyWriteRowRequest request = new ReadModifyWriteRowRequest { TableNameAsTableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]"), RowKey = ByteString.Empty, Rules = { new ReadModifyWriteRule(), }, AppProfileId = "", }; // Make the request ReadModifyWriteRowResponse response = bigtableClient.ReadModifyWriteRow(request); }
public async Task ReadModifyWriteRowAsync2() { Mock <Bigtable.BigtableClient> mockGrpcClient = new Mock <Bigtable.BigtableClient>(MockBehavior.Strict); ReadModifyWriteRowRequest request = new ReadModifyWriteRowRequest { TableNameAsTableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"), RowKey = ByteString.CopyFromUtf8("122"), Rules = { }, }; ReadModifyWriteRowResponse expectedResponse = new ReadModifyWriteRowResponse(); mockGrpcClient.Setup(x => x.ReadModifyWriteRowAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ReadModifyWriteRowResponse>(Task.FromResult(expectedResponse), null, null, null, null)); BigtableServiceApiClient client = new BigtableServiceApiClientImpl(mockGrpcClient.Object, null); ReadModifyWriteRowResponse response = await client.ReadModifyWriteRowAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void ReadModifyWriteRow() { Mock <Bigtable.BigtableClient> mockGrpcClient = new Mock <Bigtable.BigtableClient>(MockBehavior.Strict); ReadModifyWriteRowRequest expectedRequest = new ReadModifyWriteRowRequest { TableNameAsTableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"), RowKey = ByteString.CopyFromUtf8("122"), Rules = { }, }; ReadModifyWriteRowResponse expectedResponse = new ReadModifyWriteRowResponse(); mockGrpcClient.Setup(x => x.ReadModifyWriteRow(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); BigtableServiceApiClient client = new BigtableServiceApiClientImpl(mockGrpcClient.Object, null); TableName tableName = new TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"); ByteString rowKey = ByteString.CopyFromUtf8("122"); IEnumerable <ReadModifyWriteRule> rules = new List <ReadModifyWriteRule>(); ReadModifyWriteRowResponse response = client.ReadModifyWriteRow(tableName, rowKey, rules); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void ReadModifyWriteRow1ResourceNames() { moq::Mock <Bigtable.BigtableClient> mockGrpcClient = new moq::Mock <Bigtable.BigtableClient>(moq::MockBehavior.Strict); ReadModifyWriteRowRequest request = new ReadModifyWriteRowRequest { TableNameAsTableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]"), RowKey = proto::ByteString.CopyFromUtf8("row_key7adfb7cb"), Rules = { new ReadModifyWriteRule(), }, }; ReadModifyWriteRowResponse expectedResponse = new ReadModifyWriteRowResponse { Row = new Row(), }; mockGrpcClient.Setup(x => x.ReadModifyWriteRow(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); BigtableClient client = new BigtableClientImpl(mockGrpcClient.Object, null); ReadModifyWriteRowResponse response = client.ReadModifyWriteRow(request.TableNameAsTableName, request.RowKey, request.Rules); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void ReadModifyWriteRow2() { moq::Mock <Bigtable.BigtableClient> mockGrpcClient = new moq::Mock <Bigtable.BigtableClient>(moq::MockBehavior.Strict); ReadModifyWriteRowRequest request = new ReadModifyWriteRowRequest { TableNameAsTableName = new gcbcv::TableName("[PROJECT]", "[INSTANCE]", "[TABLE]"), RowKey = proto::ByteString.CopyFromUtf8("row_key7adfb7cb"), Rules = { new ReadModifyWriteRule(), }, AppProfileId = "app_profile_id57fb0442", }; ReadModifyWriteRowResponse expectedResponse = new ReadModifyWriteRowResponse { Row = new Row(), }; mockGrpcClient.Setup(x => x.ReadModifyWriteRow(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); BigtableServiceApiClient client = new BigtableServiceApiClientImpl(mockGrpcClient.Object, null); ReadModifyWriteRowResponse response = client.ReadModifyWriteRow(request.TableName, request.RowKey, request.Rules, request.AppProfileId); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public override Task <ReadModifyWriteRowResponse> ReadModifyWriteRowAsync(ReadModifyWriteRowRequest request, CallSettings callSettings = null) => throw new RequestMadeException();