public void MapToProjectsTwoProjectItemsInDifferentProjectsTest()
        {
            // Simulate fileA.ts and fileB.ts being selected in Solution Explorer in multiple.sln.
            string              fileAFullPath = Path.GetFullPath(@"../../artifacts/localinstall/multiple/a/fileA.ts");
            string              fileBFullPath = Path.GetFullPath(@"../../artifacts/localinstall/multiple/b/fileB.ts");
            Solution            solution      = WebLinterPackage.Dte.ToolWindows.SolutionExplorer.UIHierarchyItems.Item(1).Object as Solution;
            ProjectItem         projectItemA  = solution.FindProjectItem(fileAFullPath);
            ProjectItem         projectItemB  = solution.FindProjectItem(fileBFullPath);
            MockUIHierarchyItem mockProjectItemHierarchyItemA = new MockUIHierarchyItem {
                Object = projectItemA
            };
            MockUIHierarchyItem mockProjectItemHierarchyItemB = new MockUIHierarchyItem {
                Object = projectItemB
            };

            UIHierarchyItem[] results = BuildSelectedItems.MapToProjects(
                new UIHierarchyItem[] { mockProjectItemHierarchyItemA, mockProjectItemHierarchyItemB }).ToArray();

            Assert.AreEqual(2, results.Length);
            Project projectObject = results[0].Object as Project;

            Assert.IsNotNull(projectObject);
            Assert.IsTrue(projectObject.FullName
                          .EndsWith("\\src\\WebLinterTest\\artifacts\\localinstall\\multiple\\a\\a.csproj"));
            Project projectObject2 = results[1].Object as Project;

            Assert.IsNotNull(projectObject2);
            Assert.IsTrue(projectObject2.FullName
                          .EndsWith("\\src\\WebLinterTest\\artifacts\\localinstall\\multiple\\b\\b.csproj"));
        }
        public void MapToProjectsItemNotInProjectTest()
        {
            // package.json in b isn't in a project or solution
            string fileFullPath = Path.GetFullPath(@"../../artifacts/localinstall/multiple/b/package.json");

            Assert.IsTrue(File.Exists(fileFullPath));
            Solution            solution    = WebLinterPackage.Dte.ToolWindows.SolutionExplorer.UIHierarchyItems.Item(1).Object as Solution;
            ProjectItem         projectItem = solution.FindProjectItem(fileFullPath);
            MockUIHierarchyItem mockProjectItemHierarchyItem = new MockUIHierarchyItem {
                Object = projectItem
            };

            UIHierarchyItem[] results = BuildSelectedItems.MapToProjects(new UIHierarchyItem[] { mockProjectItemHierarchyItem }).ToArray();

            Assert.AreEqual(0, results.Length);
        }
        public void MapToProjectsSingleProjectItemTest()
        {
            // Simulate fileA.ts being selected in Solution Explorer in multiple.sln.
            // Ensure a.csproj (which contains fileA.ts) is the item we calculate as building
            string              fileAFullPath = Path.GetFullPath(@"../../artifacts/localinstall/multiple/a/fileA.ts");
            Solution            solution      = WebLinterPackage.Dte.ToolWindows.SolutionExplorer.UIHierarchyItems.Item(1).Object as Solution;
            ProjectItem         projectItem   = solution.FindProjectItem(fileAFullPath);
            MockUIHierarchyItem mockProjectItemHierarchyItem = new MockUIHierarchyItem {
                Object = projectItem
            };

            UIHierarchyItem[] results = BuildSelectedItems.MapToProjects(new UIHierarchyItem[] { mockProjectItemHierarchyItem }).ToArray();

            Assert.AreEqual(1, results.Length);
            Project projectObject = results[0].Object as Project;

            Assert.IsNotNull(projectObject);
            Assert.IsTrue(projectObject.FullName
                          .EndsWith("\\src\\WebLinterTest\\artifacts\\localinstall\\multiple\\a\\a.csproj"));
        }