A ISuiteExplorer implementation which discovers modules and projects by traversing the file system starting from the suite's root directory.
Inheritance: ISuiteExplorer
Ejemplo n.º 1
0
        public void ExistingModulesMergedWithDiscoveredOnes()
        {
            var fs = new TestFileSystemDirectory("root",
                                                 new TestFileSystemDirectory("src",
                                                                             new TestFileSystemDirectory("Module1",
                                                                                                         new TestFileSystemDirectory
                                                                                                             ("Project11"))));

            var suite = new Suite(fs);

            var module1 = suite.GetModule("Module1");
            var projectA = module1.GetProject("ProjectA");

            module1.Projects.Should().HaveCount(1);
            module1.Projects.Should().HaveElementAt(0, projectA);

            var discovery = new ModuleProjectDiscovery(fs);
            discovery.ExtendWithDiscoveries(suite);

            suite.Modules.Should().HaveCount(1);
            suite.Modules.Should().HaveElementAt(0, module1);
            module1.Projects.Should().HaveCount(2);
            module1.Projects.Should().Contain(projectA);
            module1.Projects.Should().Contain(p => p.Name == "Project11");
        }
Ejemplo n.º 2
0
        public void ProjectsDiscovered()
        {
            var fs = new TestFileSystemDirectory("root",
                                     new TestFileSystemDirectory("src",
                                                                 new TestFileSystemDirectory("Module1",
                                                                     new TestFileSystemDirectory("Project11")),
                                                                 new TestFileSystemDirectory("Module2"),
                                                                 new TestFileSystemDirectory("Module3",
                                                                     new TestFileSystemDirectory("Project31"),
                                                                     new TestFileSystemDirectory("Project32"))),
                                     new TestFileSystemDirectory("output"));

            var suite = new Suite(fs);

            suite.Modules.Should().BeEmpty();

            var discovery = new ModuleProjectDiscovery(fs);
            discovery.ExtendWithDiscoveries(suite);

            suite.Modules.Should().HaveCount(3);
            suite.Modules.Should().OnlyContain(m => m.Name == "Module1" ||
                                                    m.Name == "Module2" ||
                                                    m.Name == "Module3");

            suite.GetModule("Module1").Projects.Should().HaveCount(1);
            suite.GetModule("Module1").Projects.Should().Contain(p => p.Name == "Project11");
            suite.GetModule("Module2").Projects.Should().HaveCount(0);
            suite.GetModule("Module3").Projects.Should().HaveCount(2);
            suite.GetModule("Module3").Projects.Should().Contain(p => p.Name == "Project31");
            suite.GetModule("Module3").Projects.Should().Contain(p => p.Name == "Project32");
        }
Ejemplo n.º 3
0
        public void NoSourceDirectoryDoesNotCauseError()
        {
            var fs = new TestFileSystemDirectory("root",
                                     new TestFileSystemDirectory("abc"),
                                     new TestFileSystemDirectory("output"));

            var suite = new Suite(fs);

            suite.Modules.Should().BeEmpty();

            var discovery = new ModuleProjectDiscovery(fs);
            discovery.ExtendWithDiscoveries(suite);

            suite.Modules.Should().BeEmpty();
        }
Ejemplo n.º 4
0
        public void ExistingSourcesMergedWithDiscoveredOnes()
        {
            var fs = CreateFsWithSources();

            var suite = new Suite(fs);

            var fsSet = suite.GetModule("Module1").GetProject("Project11").GetSourceSet("fs");
            var vbSet = suite.GetModule("Module1").GetProject("Project11").GetSourceSet("vb");

            fsSet.Add(new SuiteRelativePath(Path.Combine("src", "Module1", "Project11", "fs", "b.fs")));
            vbSet.Add(new SuiteRelativePath(Path.Combine("src", "Module1", "Project11", "vb", "x.vb")));

            var discovery = new ModuleProjectDiscovery(fs);
            discovery.ExtendWithDiscoveries(suite);

            var project = suite.GetModule("Module1").GetProject("Project11");
            project.SourceSets.Should().HaveCount(3);
            project.SourceSets.Should().Contain(set => set.Type == "cs");
            project.SourceSets.Should().Contain(set => set.Type == "fs");
            project.SourceSets.Should().Contain(set => set.Type == "vb");

            var csSet = project.GetSourceSet("cs");
            fsSet = project.GetSourceSet("fs");
            vbSet = project.GetSourceSet("vb");

            csSet.Files.Should().HaveCount(3);
            csSet.Files.Should().Contain(new SuiteRelativePath(Path.Combine("src", "Module1", "Project11", "cs", "source1.cs")));
            csSet.Files.Should().Contain(new SuiteRelativePath(Path.Combine("src", "Module1", "Project11", "cs", "source2.cs")));
            csSet.Files.Should().Contain(new SuiteRelativePath(Path.Combine("src", "Module1", "Project11", "cs", "subdir", "source3.cs")));

            fsSet.Files.Should().HaveCount(2);
            fsSet.Files.Should().Contain(new SuiteRelativePath(Path.Combine("src", "Module1", "Project11", "fs", "a.fs")));
            fsSet.Files.Should().Contain(new SuiteRelativePath(Path.Combine("src", "Module1", "Project11", "fs", "b.fs")));

            vbSet.Files.Should().HaveCount(1);
            vbSet.Files.Should().HaveElementAt(0, new SuiteRelativePath(Path.Combine("src", "Module1", "Project11", "vb", "x.vb")));
        }
Ejemplo n.º 5
0
        public void TestProjectsDiscovered()
        {
            var fs = CreateFsWithSourcesAndTests();

            var suite = new Suite(fs);
            suite.Modules.Should().BeEmpty();

            var discovery = new ModuleProjectDiscovery(fs);
            discovery.ExtendWithDiscoveries(suite);

            suite.Modules.Should().HaveCount(3);
            suite.Modules.Should().OnlyContain(m => m.Name == "Module1" ||
                                                    m.Name == "Module2" ||
                                                    m.Name == "Module3");

            var mod3 = suite.GetModule("Module3");
            mod3.Projects.Should().HaveCount(2);
            mod3.Projects.Should().Contain(p => p.Name == "Project31");
            mod3.Projects.Should().Contain(p => p.Name == "Project32");
            mod3.TestProjects.Should().HaveCount(2);
            mod3.TestProjects.Should().Contain(p => p.Name == "Project31.Test");
            mod3.TestProjects.Should().Contain(p => p.Name == "Project32.Test");
        }
Ejemplo n.º 6
0
        public void SourceSetsDiscovered()
        {
            var fs = CreateFsWithSources();

            var suite = new Suite(fs);

            suite.Modules.Should().BeEmpty();

            var discovery = new ModuleProjectDiscovery(fs);
            discovery.ExtendWithDiscoveries(suite);

            var project = suite.GetModule("Module1").GetProject("Project11");
            project.SourceSets.Should().HaveCount(2);
            project.SourceSets.Should().Contain(set => set.Type == "cs");
            project.SourceSets.Should().Contain(set => set.Type == "fs");

            var csSet = project.GetSourceSet("cs");
            var fsSet = project.GetSourceSet("fs");

            csSet.Files.Should().HaveCount(3);
            csSet.Files.Should().Contain(new SuiteRelativePath("src\\Module1\\Project11\\cs\\source1.cs"));
            csSet.Files.Should().Contain(new SuiteRelativePath("src\\Module1\\Project11\\cs\\source2.cs"));
            csSet.Files.Should().Contain(new SuiteRelativePath("src\\Module1\\Project11\\cs\\subdir\\source3.cs"));

            fsSet.Files.Should().HaveCount(1);
            fsSet.Files.Should().HaveElementAt(0, new SuiteRelativePath("src\\Module1\\Project11\\fs\\a.fs"));
        }