コード例 #1
0
ファイル: IgnoreTests.cs プロジェクト: xqrzd/kudu-client-net
    public async Task TestUpdateIgnore()
    {
        var builder = ClientTestUtil.GetBasicSchema()
                      .SetTableName(nameof(TestUpdateIgnore));

        var table = await _client.CreateTableAsync(builder);

        // Test update ignore does not return a row error.
        var update1 = ClientTestUtil.CreateBasicSchemaUpdateIgnore(table, 1, 1, false);
        await _client.WriteAsync(new[] { update1 });

        Assert.Empty(await ClientTestUtil.ScanTableToStringsAsync(_client, table));

        var insert = ClientTestUtil.CreateBasicSchemaInsert(table, 1);
        await _client.WriteAsync(new[] { insert });

        Assert.Single(await ClientTestUtil.ScanTableToStringsAsync(_client, table));

        // Test update ignore implements normal update.
        var update2 = ClientTestUtil.CreateBasicSchemaUpdateIgnore(table, 1, 2, false);
        await _client.WriteAsync(new[] { update2 });

        var rowStrings = await ClientTestUtil.ScanTableToStringsAsync(_client, table);

        var rowString = Assert.Single(rowStrings);

        Assert.Equal(
            "INT32 key=1, INT32 column1_i=2, INT32 column2_i=3, " +
            "STRING column3_s=a string, BOOL column4_b=True", rowString);
    }