SetVBProjectKind() public method

public SetVBProjectKind ( ) : void
return void
示例#1
0
        public void Mapper_ForProject_KnownLanguage_ReturnsCorrectLanguage_VB()
        {
            // Test case 3: VB - non-Core
            // Arrange
            var vbNetProject = new ProjectMock("vb1.vbproj");

            vbNetProject.SetVBProjectKind();

            // Act
            var vbNetProjectLanguage = ProjectToLanguageMapper.GetLanguageForProject(vbNetProject);

            // Assert
            vbNetProjectLanguage.Should().Be(Language.VBNET, "Unexpected Language for VB project");
        }
        public void ProjectPropertyManager_GetSelectedProjects_HasSelectedProjects_ReturnsProjects()
        {
            // Setup
            var p1 = new ProjectMock("p1.proj");
            var p2 = new ProjectMock("p2.proj");
            var p3 = new ProjectMock("p3.proj");
            p1.SetCSProjectKind();
            p2.SetVBProjectKind();
            // p3 is unknown kind
            var expectedProjects = new ProjectMock[] { p1, p2, p3 };
            this.projectSystem.SelectedProjects = expectedProjects;

            ProjectPropertyManager testSubject = this.CreateTestSubject();

            // Act
            Project[] actualProjects = testSubject.GetSelectedProjects().ToArray();

            // Verify
            CollectionAssert.AreEquivalent(expectedProjects, actualProjects, "Unexpected selected projects");
        }
        public void ProjectPropertyManager_GetSelectedProjects_HasSelectedProjects_ReturnsProjects()
        {
            // Arrange
            var p1 = new ProjectMock("p1.proj");
            var p2 = new ProjectMock("p2.proj");
            var p3 = new ProjectMock("p3.proj");

            p1.SetCSProjectKind();
            p2.SetVBProjectKind();
            // p3 is unknown kind
            var expectedProjects = new ProjectMock[] { p1, p2, p3 };

            this.projectSystem.SelectedProjects = expectedProjects;

            ProjectPropertyManager testSubject = this.CreateTestSubject();

            // Act
            Project[] actualProjects = testSubject.GetSelectedProjects().ToArray();

            // Assert
            CollectionAssert.AreEquivalent(expectedProjects, actualProjects, "Unexpected selected projects");
        }
        public void BindingWorkflow_GetBindingLanguages_FiltersProjectsWithUnsupportedPluginLanguage()
        {
            // Arrange
            var testSubject = this.CreateTestSubject();

            var csProject1 = new ProjectMock("cs1.csproj");
            var csProject2 = new ProjectMock("cs2.csproj");
            var csProject3 = new ProjectMock("cs3.csproj");

            csProject1.SetCSProjectKind();
            csProject2.SetCSProjectKind();
            csProject3.SetCSProjectKind();
            var vbNetProject1 = new ProjectMock("vb1.vbproj");
            var vbNetProject2 = new ProjectMock("vb2.vbproj");

            vbNetProject1.SetVBProjectKind();
            vbNetProject2.SetVBProjectKind();
            var projects = new[]
            {
                csProject1,
                csProject2,
                vbNetProject1,
                csProject3,
                vbNetProject2
            };

            testSubject.BindingProjects.AddRange(projects);

            var expectedLanguages = new[] { Language.VBNET };

            this.host.SupportedPluginLanguages.UnionWith(expectedLanguages);

            // Act
            var actualLanguages = testSubject.GetBindingLanguages();

            // Assert
            CollectionAssert.AreEquivalent(expectedLanguages, actualLanguages.ToArray(), "Unexpected languages for binding projects");
        }
示例#5
0
        public void BindingWorkflow_GetBindingLanguages_ReturnsDistinctLanguagesForProjects()
        {
            // Setup
            var testSubject = this.CreateTestSubject();

            var csProject1 = new ProjectMock("cs1.csproj");
            var csProject2 = new ProjectMock("cs2.csproj");
            var csProject3 = new ProjectMock("cs3.csproj");

            csProject1.SetCSProjectKind();
            csProject2.SetCSProjectKind();
            csProject3.SetCSProjectKind();
            var vbNetProject1 = new ProjectMock("vb1.vbproj");
            var vbNetProject2 = new ProjectMock("vb2.vbproj");

            vbNetProject1.SetVBProjectKind();
            vbNetProject2.SetVBProjectKind();
            var projects = new[]
            {
                csProject1,
                csProject2,
                vbNetProject1,
                csProject3,
                vbNetProject2
            };

            testSubject.BindingProjects.AddRange(projects);

            var expectedLanguages = new[] { Language.CSharp, Language.VBNET };

            // Act
            var actualLanguages = testSubject.GetBindingLanguages();

            // Verify
            CollectionAssert.AreEquivalent(expectedLanguages, actualLanguages.ToArray(), "Unexpected languages for binding projects");
        }
        private void ConfigureSupportedBindingProject(BindingProcessImpl.BindingProcessState internalState, Language language)
        {
            // Mark the language as supported by the host
            host.SupportedPluginLanguages.Add(language);

            // Create a dummy project and add it to the internal state
            var project = new ProjectMock(null);

            switch (language.Id)
            {
            case "VB":
                project.SetVBProjectKind();
                break;

            case "CSharp":
                project.SetCSProjectKind();
                break;

            default:
                Assert.Fail($"Test setup error: unknown language: {language}");
                break;
            }
            internalState.BindingProjects.Add(project);
        }
        public void Language_ForProject_KnownLanguage_ReturnsCorrectLanguage()
        {
            // Test case 1: Unknown
            // Setup
            var otherProject = new ProjectMock("other.proj");

            // Act
            var otherProjectLanguage = Language.ForProject(otherProject);

            // Verify
            Assert.AreEqual(Language.Unknown, otherProjectLanguage, "Unexpected Language for unknown project");

            // Test case 2: C#
            // Setup
            var csProject = new ProjectMock("cs1.csproj");

            csProject.SetCSProjectKind();

            // Act
            var csProjectLanguage = Language.ForProject(csProject);

            // Verify
            Assert.AreEqual(Language.CSharp, csProjectLanguage, "Unexpected Language for C# project");

            // Test case 3: VB
            // Setup
            var vbNetProject = new ProjectMock("vb1.vbproj");

            vbNetProject.SetVBProjectKind();

            // Act
            var vbNetProjectLanguage = Language.ForProject(vbNetProject);

            // Verify
            Assert.AreEqual(Language.VBNET, vbNetProjectLanguage, "Unexpected Language for C# project");
        }
示例#8
0
        public void Language_ForProject_KnownLanguage_ReturnsCorrectLanguage()
        {
            // Test case 1: Unknown
            // Arrange
            var otherProject = new ProjectMock("other.proj");

            // Act
            var otherProjectLanguage = Language.ForProject(otherProject);

            // Assert
            otherProjectLanguage.Should().Be(Language.Unknown, "Unexpected Language for unknown project");

            // Test case 2: C#
            // Arrange
            var csProject = new ProjectMock("cs1.csproj");

            csProject.SetCSProjectKind();

            // Act
            var csProjectLanguage = Language.ForProject(csProject);

            // Assert
            csProjectLanguage.Should().Be(Language.CSharp, "Unexpected Language for C# project");

            // Test case 3: VB
            // Arrange
            var vbNetProject = new ProjectMock("vb1.vbproj");

            vbNetProject.SetVBProjectKind();

            // Act
            var vbNetProjectLanguage = Language.ForProject(vbNetProject);

            // Assert
            vbNetProjectLanguage.Should().Be(Language.VBNET, "Unexpected Language for C# project");
        }
        public void BindingWorkflow_GetBindingLanguages_ReturnsDistinctLanguagesForProjects()
        {
            // Setup
            var testSubject = this.CreateTestSubject();

            var csProject1 = new ProjectMock("cs1.csproj");
            var csProject2 = new ProjectMock("cs2.csproj");
            var csProject3 = new ProjectMock("cs3.csproj");
            csProject1.SetCSProjectKind();
            csProject2.SetCSProjectKind();
            csProject3.SetCSProjectKind();
            var vbNetProject1 = new ProjectMock("vb1.vbproj");
            var vbNetProject2 = new ProjectMock("vb2.vbproj");
            vbNetProject1.SetVBProjectKind();
            vbNetProject2.SetVBProjectKind();
            var projects = new[]
            {
                csProject1,
                csProject2,
                vbNetProject1,
                csProject3,
                vbNetProject2
            };
            testSubject.BindingProjects.AddRange(projects);

            var expectedLanguages = new[] { Language.CSharp, Language.VBNET };

            // Act
            var actualLanguages = testSubject.GetBindingLanguages();

            // Verify
            CollectionAssert.AreEquivalent(expectedLanguages, actualLanguages.ToArray(), "Unexpected languages for binding projects");
        }
        public void Language_ForProject_KnownLanguage_ReturnsCorrectLanguage()
        {
            // Test case 1: Unknown
            // Setup
            var otherProject = new ProjectMock("other.proj");

            // Act
            var otherProjectLanguage = Language.ForProject(otherProject);

            // Verify
            Assert.AreEqual(Language.Unknown, otherProjectLanguage, "Unexpected Language for unknown project");

            // Test case 2: C#
            // Setup
            var csProject = new ProjectMock("cs1.csproj");
            csProject.SetCSProjectKind();

            // Act
            var csProjectLanguage = Language.ForProject(csProject);

            // Verify
            Assert.AreEqual(Language.CSharp, csProjectLanguage, "Unexpected Language for C# project");

            // Test case 3: VB
            // Setup
            var vbNetProject = new ProjectMock("vb1.vbproj");
            vbNetProject.SetVBProjectKind();

            // Act
            var vbNetProjectLanguage = Language.ForProject(vbNetProject);

            // Verify
            Assert.AreEqual(Language.VBNET, vbNetProjectLanguage, "Unexpected Language for C# project");
        }