示例#1
0
        private async Task ReadWithMappingTest(int index)
        {
            var table = _hbaseHelper.GetTableName <Student>();

            var cancel = new CancellationToken();

            var studentsFromHb = (await _client.getRowAsync(
                                      table.ToBytes(),
                                      index.ToString().Reverse2String().ToBytes(),
                                      null,
                                      cancel))
                                 .Select(t => _HbaseParser.ToReal <Student>(t))
                                 .ToList();

            Assert.True(studentsFromHb.Count > 0);
            Assert.Equal(studentsFromHb.Last().Name, $"hsx{index}");
            Assert.Equal(studentsFromHb.Last().Age, index);
            Assert.True(studentsFromHb.Last().IsWork);
            Assert.Contains(studentsFromHb.Last().Hobbies, t => t == "running");
        }