示例#1
0
        public void TestMethod1()
        {
            string assemblyPath = Assembly.GetExecutingAssembly().Location;
            string workDirPath  = Path.GetDirectoryName(assemblyPath);
            string dbPath       = Path.Combine(workDirPath, "testdb.sqlite");
            var    contentList  = new ContentList(dbPath);

            contentList.Clear();
            string testPath      = assemblyPath;
            var    testTimestamp = File.GetLastWriteTime(testPath).ToUnixTimestamp();

            contentList.Add(testPath, testTimestamp, removed: false);
            Assert.IsTrue(contentList.ContainsKey(testPath));
            Assert.AreEqual(1, contentList.Count);
            Assert.AreEqual(contentList.Keys.First(), testPath);
            Assert.IsTrue(contentList.TryGetValue(testPath, out int storedTimestamp, out bool removed));
            Assert.AreEqual(testTimestamp, storedTimestamp);
            contentList.Remove(testPath);
            Assert.AreEqual(0, contentList.Count);
            contentList.Dispose();
            File.Delete(dbPath);
        }