public void TestFolderManager_DeleteDirectoryInfo() { BaseInfo.AddOldVideo(); string path = @"D:\视频录像\videoID_003_2\2002\03\22"; Directory.CreateDirectory(path); string filePath = Path.Combine(path, ".error"); using (FileStream file = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read)) { Assert.IsFalse(FolderManager.DeleteDirectoryInfo(path)); Assert.IsTrue(Directory.Exists(path)); } Assert.IsTrue(FolderManager.DeleteDirectoryInfo(path)); Assert.IsFalse(Directory.Exists(path)); Assert.IsTrue(Directory.Exists(@"d:\视频录像\videoID_003_2\2002\03")); }
public void TestVideoStoragerManager_SearchEarliestSubfolder_One() { BaseInfo.AddOldVideo(); string videoId = "videoID_003"; int streamId = 2; string path = GlobalData.VideoPath(videoId, streamId); DateTime beginTime = new DateTime(2001, 3, 23, 01, 50, 1, 156); Directory.CreateDirectory(Path.Combine(path, @"10000\01\01")); Directory.CreateDirectory(Path.Combine(path, @"2001\1\01")); string earliestPath = Path.Combine(path, GlobalProcess.FolderPath(beginTime)); var info = VideoStoragerManager.SearchEarliestSubfolder(path); Assert.IsNotNull(info); Assert.AreEqual(earliestPath, info.Path); Assert.AreEqual(beginTime.Date, info.Time); }