示例#1
0
        private async Task CheckAndMutateRow_ValidateArguments <TException>(
            TableName tableName,
            BigtableByteString rowKey,
            RowFilter predicateFilter,
            IEnumerable <Mutation> trueMutations,
            IEnumerable <Mutation> falseMutations,
            bool callTrueMutationsOnlyOverload = true)
            where TException : Exception
        {
            var client = new MockBigtableClient();

            if (callTrueMutationsOnlyOverload)
            {
                Assert.Throws <TException>(
                    () => client.CheckAndMutateRow(
                        tableName, rowKey, predicateFilter, trueMutations?.ToArray()));
            }
            Assert.Throws <TException>(
                () => client.CheckAndMutateRow(
                    tableName, rowKey, predicateFilter, trueMutations, falseMutations, CallSettings.FromCancellationToken(default)));
示例#2
0
        public static BigtableClient CreateClientForMutateRowsRetries(
            MutateRowsResponse.Types.Entry[] entriesForInitialResponse,
            MutateRowsResponse.Types.Entry[][] entriesForRetryResponses)
        {
            // Initialize the client that will be used for retries and populate it with the retry responses.
            var client = new MockBigtableClient();

            client.AddMutateRowsStream(new MockMutateRowsStream(new MutateRowsResponse {
                Entries = { entriesForInitialResponse }
            }));
            if (entriesForRetryResponses != null)
            {
                foreach (var entries in entriesForRetryResponses)
                {
                    client.AddMutateRowsStream(new MockMutateRowsStream(new MutateRowsResponse {
                        Entries = { entries }
                    }));
                }
            }

            return(client);
        }