Пример #1
0
        public void When_not_set_as_file_search_it_will_not_find_it()
        {
            var cache = new TypeCache();
            cache.Add(new Project(to("/Some/Path/Project1.cs"), ""));
            cache.Add(toFile("/Some/Path/File2.cs"));

            var verifier = new ResultVerifier(cache.FindFiles("Proj"));
            verifier.VerifyCount(0);
        }
Пример #2
0
        public void When_searching_for_a_project_it_will_return()
        {
            var cache = new TypeCache();
            cache.Add(new Project(to("/Some/Path/Project1.cs"), "").SetFileSearch());
            cache.Add(toFile("/Some/Path/File2.cs").SetFileSearch());

            var verifier = new ResultVerifier(cache.FindFiles("Proj"));
            verifier.VerifyCount(1);
            verifier.Verify(0, FileFindResultType.Project, to("/Some/Path/Project1.cs"));
        }
Пример #3
0
        public void When_searching_for_a_file_it_will_return()
        {
            var cache = new TypeCache();
            cache.Add(toFile("/Some/Path/File1.cs").SetFileSearch());
            cache.Add(toFile("/Some/Path/File2.cs").SetFileSearch());

            var verifier = new ResultVerifier(cache.FindFiles("File1"));
            verifier.VerifyCount(1);
            verifier.Verify(0, FileFindResultType.File, to("/Some/Path/File1.cs"));
        }
Пример #4
0
        public void When_not_set_as_file_search_it_will_not_find_it()
        {
            var cache = new TypeCache();

            cache.Add(new Project(to("/Some/Path/Project1.cs"), ""));
            cache.Add(toFile("/Some/Path/File2.cs"));

            var verifier = new ResultVerifier(cache.FindFiles("Proj"));

            verifier.VerifyCount(0);
        }
Пример #5
0
        public void When_searching_for_a_project_it_will_return()
        {
            var cache = new TypeCache();

            cache.Add(new Project(to("/Some/Path/Project1.cs"), "").SetFileSearch());
            cache.Add(toFile("/Some/Path/File2.cs").SetFileSearch());

            var verifier = new ResultVerifier(cache.FindFiles("Proj"));

            verifier.VerifyCount(1);
            verifier.Verify(0, FileFindResultType.Project, to("/Some/Path/Project1.cs"));
        }
Пример #6
0
        public void When_searching_for_a_file_it_will_return()
        {
            var cache = new TypeCache();

            cache.Add(toFile("/Some/Path/File1.cs").SetFileSearch());
            cache.Add(toFile("/Some/Path/File2.cs").SetFileSearch());

            var verifier = new ResultVerifier(cache.FindFiles("File1"));

            verifier.VerifyCount(1);
            verifier.Verify(0, FileFindResultType.File, to("/Some/Path/File1.cs"));
        }
Пример #7
0
        public void When_searching_for_a_file_it_will_return_the_files_with_the_lowest_hierarchical_level()
        {
            var cache = new TypeCache();
            cache.Add(toFile("/Some/Path/File1.cs").SetFileSearch());
            cache.Add(toFile("/Some/Path/File2.cs").SetFileSearch());
            cache.Add(toFile("/Some/Path/In/AnotherpathPlace/File2.cs").SetFileSearch());

            var verifier = new ResultVerifier(cache.FindFiles("Path"));
            verifier.VerifyCount(2);
            verifier.Verify(0, FileFindResultType.Directory, to("/Some/Path"));
            verifier.Verify(1, FileFindResultType.Directory, to("/Some/Path/In/AnotherpathPlace"));
        }
Пример #8
0
        public void When_searching_for_a_file_it_will_return_the_files_with_the_lowest_hierarchical_level()
        {
            var cache = new TypeCache();

            cache.Add(toFile("/Some/Path/File1.cs").SetFileSearch());
            cache.Add(toFile("/Some/Path/File2.cs").SetFileSearch());
            cache.Add(toFile("/Some/Path/In/AnotherpathPlace/File2.cs").SetFileSearch());

            var verifier = new ResultVerifier(cache.FindFiles("Path"));

            verifier.VerifyCount(2);
            verifier.Verify(0, FileFindResultType.Directory, to("/Some/Path"));
            verifier.Verify(1, FileFindResultType.Directory, to("/Some/Path/In/AnotherpathPlace"));
        }
        public void When_given_a_directory_it_will_pull_out_files_and_directories_contained_by_it()
        {
            var cache = new TypeCache();
            cache.Add(toFile("/Some/Path/File1.cs"));
            cache.Add(toFile("/Some/Path/File2.cs"));
            cache.Add(toFile("/Some/Path/In/AnotherpathPlace/File2.cs"));
            cache.Add(toFile("/Some/Path/In/AnotherpathPlace/File3.cs"));

            var verifier = new ResultVerifier(cache.GetFilesInDirectory(to("/Some/Path")));
            verifier.VerifyCount(3);
            verifier.Verify(0, FileFindResultType.File, to("/Some/Path/File1.cs"));
            verifier.Verify(1, FileFindResultType.File, to("/Some/Path/File2.cs"));
            verifier.Verify(2, FileFindResultType.Directory, to("/Some/Path/In"));
        }
        public void When_given_a_project_and_a_directory_it_will_pull_out_files_and_directories_contained_by_it()
        {
            var cache = new TypeCache();
            var project = new Project(to("/Some/Path/MyProject.csproj"), "");
            cache.Add(toFile("/Some/Path/File1.cs", project.File));
            cache.Add(toFile("/Some/Path/File2.cs", project.File));
            cache.Add(toFile("/Some/Path/In/AnotherpathPlace/File2.cs", project.File));
            cache.Add(toFile("/Some/Path/In/AnotherpathPlace/File3.cs", project.File));
            cache.Add(project);
            cache.Add(toFile("/Some/Path/In/FileNotInProject.cs"));

            var verifier = new ResultVerifier(cache.GetFilesInProject(to("/Some/Path/MyProject.csproj"), to("/Some/Path/In")));
            verifier.VerifyCount(1);
            verifier.Verify(0, FileFindResultType.DirectoryInProject, to("/Some/Path/In/AnotherpathPlace"), to("/Some/Path/MyProject.csproj"));
        }
Пример #11
0
        public void When_given_a_directory_it_will_pull_out_files_and_directories_contained_by_it()
        {
            var cache = new TypeCache();

            cache.Add(toFile("/Some/Path/File1.cs"));
            cache.Add(toFile("/Some/Path/File2.cs"));
            cache.Add(toFile("/Some/Path/In/AnotherpathPlace/File2.cs"));
            cache.Add(toFile("/Some/Path/In/AnotherpathPlace/File3.cs"));

            var verifier = new ResultVerifier(cache.GetFilesInDirectory(to("/Some/Path")));

            verifier.VerifyCount(3);
            verifier.Verify(0, FileFindResultType.File, to("/Some/Path/File1.cs"));
            verifier.Verify(1, FileFindResultType.File, to("/Some/Path/File2.cs"));
            verifier.Verify(2, FileFindResultType.Directory, to("/Some/Path/In"));
        }
Пример #12
0
        public void When_given_a_project_and_a_directory_it_will_pull_out_files_and_directories_contained_by_it()
        {
            var cache   = new TypeCache();
            var project = new Project(to("/Some/Path/MyProject.csproj"), "");

            cache.Add(toFile("/Some/Path/File1.cs", project.File));
            cache.Add(toFile("/Some/Path/File2.cs", project.File));
            cache.Add(toFile("/Some/Path/In/AnotherpathPlace/File2.cs", project.File));
            cache.Add(toFile("/Some/Path/In/AnotherpathPlace/File3.cs", project.File));
            cache.Add(project);
            cache.Add(toFile("/Some/Path/In/FileNotInProject.cs"));

            var verifier = new ResultVerifier(cache.GetFilesInProject(to("/Some/Path/MyProject.csproj"), to("/Some/Path/In")));

            verifier.VerifyCount(1);
            verifier.Verify(0, FileFindResultType.DirectoryInProject, to("/Some/Path/In/AnotherpathPlace"), to("/Some/Path/MyProject.csproj"));
        }