public void interruptionSearchFileTest() { var fs3 = new SearchOperator(@"C:\Program Files\Java"); fs3.scanDir(); ////chapter 1 var count = fs3.filesPath.Count; var t = new CancellationTokenSource(); var ts = Task.Run(() => fs3.searchFiles(".", ".", t.Token), t.Token); Thread.Sleep(400); t.Cancel(); //ts.Wait(); var c1 = count - fs3.filesPath.Count; ////chapter 2 t = new CancellationTokenSource(); ts = Task.Run(() => fs3.searchFiles(".", ".", t.Token), t.Token); Thread.Sleep(400); t.Cancel(); //ts.Wait(); //t.Dispose(); var c2 = count - fs3.filesPath.Count; //chapter3 ts = Task.Run(() => fs3.searchFiles(".", ".")); ts.Wait(); var c3 = count - fs3.filesPath.Count - c1 - c2; Assert.AreEqual(count, c1 + c2 + c3); //Assert.AreEqual(fs3.filesPath.Count, 0); }
public void searchFilesTest() { var fs3 = new SearchOperator(dir2); fs3.scanDir(); var cc = fs3.filesPath.Count; fs3.searchFiles(".", "."); Assert.AreEqual(0, fs3.filesPath.Count); Assert.AreEqual(cc, fs3.Result.Count); }
public void shallowSearchFilesTest() { var fs3 = new SearchOperator(dir); fs3.scanDir(); Assert.AreEqual(fs3.filesPath.Count, 7); fs3.searchFiles("file12", "12$"); Assert.AreEqual(fs3.Result.Count, 1); Assert.AreEqual(0, fs3.filesPath.Count); }