예제 #1
0
        public async Task CheckAndMutateRow_Validate_RowKey()
        {
            var client    = new TestBigtableClient();
            var tableName = new TableName("project", "instance", "table");

            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
                "",
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new[] { Mutations.DeleteFromRow() });
            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
                new byte[0],
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new[] { Mutations.DeleteFromRow() });
            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
                ByteString.Empty,
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new[] { Mutations.DeleteFromRow() });
            await CheckAndMutateRow_ValidateArguments <ArgumentException>(
                tableName,
예제 #2
0
        public async Task CheckAndMutateRow_Validate_TableName()
        {
            var client = new TestBigtableClient();

            await CheckAndMutateRow_ValidateArguments <ArgumentNullException>(
                null,
                "abc",
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new[] { Mutations.DeleteFromRow() });
        }
예제 #3
0
        public async Task CheckAndMutateRow_Valid_Request()
        {
            var client    = new TestBigtableClient();
            var tableName = new TableName("project", "instance", "table");

            // NotImplementedException means it got through the normal validations and tried to actually
            // make the request on the TestBigtableClient.
            await CheckAndMutateRow_ValidateArguments <NotImplementedException>(
                tableName,
                "abc",
                RowFilters.PassAllFilter(),
                new[] { Mutations.DeleteFromRow() },
                new[] { Mutations.DeleteFromRow() });
        }
        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 TestBigtableClient();

            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)));