示例#1
0
        public void MetaList_Ok()
        {
            using var area = new TestArea("metaListOkTest");
            DroneDB.Init(area.TestFolder);

            DroneDB.MetaAdd(area.TestFolder, "annotations", "123");
            DroneDB.MetaAdd(area.TestFolder, "examples", "abc");
            DroneDB.MetaList(area.TestFolder).Should().HaveCount(2);
        }
示例#2
0
        public void MetaAdd_Ok()
        {
            using var area = new TestArea("metaAddOkTest");
            DroneDB.Init(area.TestFolder);

            FluentActions.Invoking(() => DroneDB.MetaAdd(area.TestFolder, "test", "123")).Should()
            .Throw <DDBException>();    // Needs plural key
            // DroneDB.MetaAdd("metaAddTest", "", "tests", "123").Data.ToObject<int>().Should().Be(123);
        }
示例#3
0
        public void MetaAdd_Json()
        {
            using var area = new TestArea("metaAddJsonTest");
            DroneDB.Init(area.TestFolder);

            var res = DroneDB.MetaAdd(area.TestFolder, "tests", "{\"test\": true}");

            JsonConvert.SerializeObject(res.Data).Should().Be("{\"test\":true}");
            res.Id.Should().NotBeNull();
            res.ModifiedTime.Should().BeCloseTo(DateTime.UtcNow, new TimeSpan(0, 0, 1));
        }
示例#4
0
        public void MetaGet_Ok2()
        {
            using var area = new TestArea("metaGetOkTest");
            DroneDB.Init(area.TestFolder);

            DroneDB.MetaAdd(area.TestFolder, "tests", "{\"test\":true}");
            DroneDB.MetaAdd(area.TestFolder, "tests", "{\"test\":false}");
            DroneDB.MetaAdd(area.TestFolder, "tests", "{\"test\":null}");

            var res = JsonConvert.DeserializeObject <Meta[]>(DroneDB.MetaGet(area.TestFolder, "tests"));

            res.Should().HaveCount(3);
        }