public async Task CheckAndMutateRow_AppProfileId_From_Client() { var appProfileIdOnClient = "csharp"; var request = new CheckAndMutateRowRequest { TableNameAsTableName = new TableName("project", "instance", "table"), RowKey = ByteString.CopyFromUtf8("abc"), FalseMutations = { new Mutation() }, TrueMutations = { new Mutation() } }; var request2 = new CheckAndMutateRowRequest(request); Mock <BigtableServiceApiClient> mockGrpcClient = new Mock <BigtableServiceApiClient>(MockBehavior.Strict); mockGrpcClient .Setup(x => x.CheckAndMutateRow(request, It.IsAny <CallSettings>())) .Returns(new CheckAndMutateRowResponse()); mockGrpcClient .Setup(x => x.CheckAndMutateRowAsync(request, It.IsAny <CallSettings>())) .ReturnsAsync(new CheckAndMutateRowResponse()); BigtableClient client = new BigtableClientImpl(mockGrpcClient.Object, appProfileIdOnClient); client.CheckAndMutateRow(request); await client.CheckAndMutateRowAsync(request2); Assert.Equal(appProfileIdOnClient, request.AppProfileId); Assert.Equal(appProfileIdOnClient, request2.AppProfileId); }
public void CheckAndMutateRow1ResourceNames() { moq::Mock <Bigtable.BigtableClient> mockGrpcClient = new moq::Mock <Bigtable.BigtableClient>(moq::MockBehavior.Strict); CheckAndMutateRowRequest request = new CheckAndMutateRowRequest { TableNameAsTableName = TableName.FromProjectInstanceTable("[PROJECT]", "[INSTANCE]", "[TABLE]"), RowKey = proto::ByteString.CopyFromUtf8("row_key7adfb7cb"), TrueMutations = { new Mutation(), }, FalseMutations = { new Mutation(), }, PredicateFilter = new RowFilter(), }; CheckAndMutateRowResponse expectedResponse = new CheckAndMutateRowResponse { PredicateMatched = true, }; mockGrpcClient.Setup(x => x.CheckAndMutateRow(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); BigtableClient client = new BigtableClientImpl(mockGrpcClient.Object, null); CheckAndMutateRowResponse response = client.CheckAndMutateRow(request.TableNameAsTableName, request.RowKey, request.PredicateFilter, request.TrueMutations, request.FalseMutations); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }