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);
        }
        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"));
        }
        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"));
        }
Exemple #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);
        }
Exemple #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"));
        }
Exemple #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"));
        }
        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"));
        }
Exemple #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"));
        }
        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"));
        }