Example #1
0
        public async Task Can_get_record_by_column_value()
        {
            using var fixture = new RecordStoreFixture();

            var record = new Record {
                Type = "Customer"
            };

            record.Columns.Add(new RecordColumn(0, "Order", "int", "123", "0"));

            var current = await fixture.Store.AddRecordAsync(record);

            Assert.Equal(0UL, record.Index);
            Assert.Equal(0UL, current);

            var count = await fixture.Store.GetLengthByTypeAsync("Customer");

            Assert.Equal(1UL, count);

            var fetched = await fixture.Store.GetByColumnValueAsync("Customer", "Order", "123");

            var list = fetched.AsList();

            Assert.NotEmpty(list);

            var missing = await fixture.Store.GetByColumnValueAsync("Customer", "Order", "234");

            list = missing.AsList();
            Assert.Empty(list);
        }
Example #2
0
        public async Task Empty_store_has_zero_length()
        {
            using var fixture = new RecordStoreFixture();
            var count = await fixture.Store.GetLengthAsync();

            Assert.Equal(0UL, count);
        }
Example #3
0
        public async Task Can_append_record_and_retrieve_by_uuid()
        {
            using var fixture = new RecordStoreFixture();

            var record = new Record {
                Type = "Customer"
            };

            record.Columns.Add(new RecordColumn(0, "Order", "int", "123", "0"));

            var current = await fixture.Store.AddRecordAsync(record);

            Assert.Equal(0UL, record.Index);
            Assert.Equal(0UL, current);

            var count = await fixture.Store.GetLengthByTypeAsync("Customer");

            Assert.Equal(1UL, count);

            var fetched = await fixture.Store.GetByIdAsync(record.Uuid);

            Assert.NotNull(fetched);

            var badId   = Guid.NewGuid();
            var missing = await fixture.Store.GetByIdAsync(badId);

            Assert.Null(missing);
        }