Exemplo n.º 1
0
        public void ChapterTestFindData()
        {
            var path = "ibox";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            using (var server = new DB(path))
            {
                var config = server.GetConfig();
                config.EnsureTable <Chapter>(TableName.Chapters, "id");
                var db        = server.Open();
                var chapterDb = new ChapterDb(db);

                chapterDb.Add(new Chapter()
                {
                    id     = "1",
                    name   = "chapter1",
                    bookid = "1"
                });
                var list = chapterDb.GetChaptersByBookId("1");
                chapterDb.Delete("1");
                Assert.True(list.Count > 0);
            }
        }
Exemplo n.º 2
0
        public void ChapterTestInsertData()
        {
            var path = "ibox";
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            using (var server = new DB(path))
            {
                var config = server.GetConfig();
                config.EnsureTable<Chapter>(TableName.Chapters, "id");
                var db = server.Open();
                var chapterDb = new ChapterDb(db);
                chapterDb.Add(new Chapter()
                {
                    id = "1",
                    name = "chapter1",
                    bookid = "1"
                });
                chapterDb.Delete("1");
            }
        }