public void TestBasicFileIndex() { FileIndex fileIndex = new FileIndex(); string[] fileList = { @"c:\bah\humbug\foo\bar\123.txt", @"c:\bah\humbug\foo\bar\humbug.txt", @"c:\bah\humbug\foo\bar\cat.txt", @"c:\bah\humbug\cat\dog.txt", @"c:\bah\humbug\cat\dog\animals.txt", @"c:\bah\dog\manyanimals.jpg", @"c:\bah\cat\manyanimals.jpg", @"c:\project\Thing1\obj\output.obj", @"c:\project\Thing2\obj\output.obj", @"c:\project\Thing2\obj\cacaca.obj", @"c:\project\Thing2\obj\bubu.obj", }; foreach (string file in fileList) { fileIndex.AddFile(file); } TestFileIndexCase(fileIndex, "123", new string[] { @"c:\bah\humbug\foo\bar\123.txt" }); TestFileIndexCase(fileIndex, "humbugster", new string[] { }); TestFileIndexCase(fileIndex, ".t", new string[] { @"c:\bah\humbug\foo\bar\123.txt", @"c:\bah\humbug\foo\bar\cat.txt", @"c:\bah\humbug\cat\dog.txt", @"c:\bah\humbug\foo\bar\humbug.txt", @"c:\bah\humbug\cat\dog\animals.txt" }); TestFileIndexCase(fileIndex, "anIM", new string[] { @"c:\bah\humbug\cat\dog\animals.txt", @"c:\bah\cat\manyanimals.jpg", @"c:\bah\dog\manyanimals.jpg" }); TestFileIndexCase(fileIndex, "bu", new string[] { @"c:\project\Thing2\obj\bubu.obj", @"c:\bah\humbug\foo\bar\humbug.txt", @"c:\bah\humbug\cat\dog.txt", @"c:\bah\humbug\cat\dog\animals.txt", @"c:\bah\humbug\foo\bar\123.txt", @"c:\bah\humbug\foo\bar\cat.txt" }); TestFileIndexCase(fileIndex, "obj", new string[] { @"c:\project\Thing2\obj\bubu.obj" , @"c:\project\Thing2\obj\cacaca.obj", @"c:\project\Thing1\obj\output.obj", @"c:\project\Thing2\obj\output.obj" }); TestFileIndexCase(fileIndex, "ing", new string[] { @"c:\project\Thing1\obj\output.obj", @"c:\project\Thing2\obj\bubu.obj", @"c:\project\Thing2\obj\cacaca.obj", @"c:\project\Thing2\obj\output.obj" }); TestFileIndexCase(fileIndex, "cat\\", new string[] { @"c:\bah\cat\manyanimals.jpg", @"c:\bah\humbug\cat\dog.txt", @"c:\bah\humbug\cat\dog\animals.txt" }); TestFileIndexCase(fileIndex, "humbug\\cat\\", new string[] { @"c:\bah\humbug\cat\dog.txt", @"c:\bah\humbug\cat\dog\animals.txt" }); TestFileIndexCase(fileIndex, "at\\", new string[] { @"c:\bah\cat\manyanimals.jpg", @"c:\bah\humbug\cat\dog.txt", @"c:\bah\humbug\cat\dog\animals.txt" }); TestFileIndexCase(fileIndex, "cat\\d", new string[] { @"c:\bah\humbug\cat\dog.txt", @"c:\bah\humbug\cat\dog\animals.txt" }); TestFileIndexCase(fileIndex, "cat\\a", new string[] {} ); TestFileIndexCase(fileIndex, "dfgdfgsdgsdgsdfgsdgqrsdfasfadsfgdsg\\humbu", new string[] { }); TestFileIndexCase(fileIndex, @"Thing1\o", new string[] { @"c:\project\Thing1\obj\output.obj" } ); TestFileIndexCase(fileIndex, @"thing2", new string[] { @"c:\project\Thing2\obj\bubu.obj", @"c:\project\Thing2\obj\cacaca.obj", @"c:\project\Thing2\obj\output.obj" }); TestFileIndexCase(fileIndex, @"Thing2\", new string[] { @"c:\project\Thing2\obj\bubu.obj", @"c:\project\Thing2\obj\cacaca.obj", @"c:\project\Thing2\obj\output.obj" }); TestFileIndexCase(fileIndex, @"Thing2", new string[] { @"c:\project\Thing2\obj\bubu.obj", @"c:\project\Thing2\obj\cacaca.obj", @"c:\project\Thing2\obj\output.obj" }); TestFileIndexCase(fileIndex, @"Thing2\ob", new string[] { @"c:\project\Thing2\obj\bubu.obj", @"c:\project\Thing2\obj\cacaca.obj", @"c:\project\Thing2\obj\output.obj" }); TestFileIndexCase(fileIndex, @"thing2\obj", new string[] { @"c:\project\Thing2\obj\bubu.obj", @"c:\project\Thing2\obj\cacaca.obj", @"c:\project\Thing2\obj\output.obj" }); TestFileIndexCase(fileIndex, @"Thing2\obJ\", new string[] { @"c:\project\Thing2\obj\bubu.obj", @"c:\project\Thing2\obj\cacaca.obj", @"c:\project\Thing2\obj\output.obj" }); TestFileIndexCase(fileIndex, @"Thing2\OBJ\B", new string[] { @"c:\project\Thing2\obj\bubu.obj" }); TestFileIndexCase(fileIndex, "", new string[] { @"c:\bah\cat\manyanimals.jpg", @"c:\bah\dog\manyanimals.jpg", @"c:\bah\humbug\cat\dog.txt", @"c:\bah\humbug\cat\dog\animals.txt", @"c:\bah\humbug\foo\bar\123.txt", @"c:\bah\humbug\foo\bar\cat.txt", @"c:\bah\humbug\foo\bar\humbug.txt", @"c:\project\Thing1\obj\output.obj", @"c:\project\Thing2\obj\bubu.obj", @"c:\project\Thing2\obj\cacaca.obj", @"c:\project\Thing2\obj\output.obj" }); fileIndex.RemoveAll(); TestFileIndexCase(fileIndex, "obj", new string[] { }); }