public void ShouldGetLinkedProject() { var solution = new MockIVsSolution(); TestableProjectLinkTracker tracker = new TestableProjectLinkTracker(new MockDocumentTracker(), solution); var project1VsHierarchy = new MockVsHierarchy(); var project2VsHierarchy = new MockVsHierarchy(); solution.Hierarchies.Add(project1VsHierarchy); solution.Hierarchies.Add(project2VsHierarchy); tracker.AddProjectLink(project1VsHierarchy, project2VsHierarchy); var projectLinks = tracker.GetProjectLinks(); Assert.AreEqual(1, projectLinks.Count()); var projectLink = projectLinks.ElementAt(0); Assert.AreEqual(project1VsHierarchy.GetPropertyProjectIdGuidValue, projectLink.SourceProjectId); Assert.AreEqual(project2VsHierarchy.GetPropertyProjectIdGuidValue, projectLink.TargetProjectId); }
public void ShouldUnlinkProjects() { var solution = new MockIVsSolution(); TestableProjectLinkTracker tracker = new TestableProjectLinkTracker(new MockDocumentTracker(), solution); var sourceVsHierarchy = new MockVsHierarchy(); var targetVsHierarchy = new MockVsHierarchy(); solution.Hierarchies.Add(sourceVsHierarchy); solution.Hierarchies.Add(targetVsHierarchy); tracker.AddProjectLink(sourceVsHierarchy, targetVsHierarchy); targetVsHierarchy.GetPropertyProjectValue.Globals.set_VariablePersistsCalled = false; tracker.UnlinkProjects(sourceVsHierarchy.GetPropertyProjectIdGuidValue, targetVsHierarchy.GetPropertyProjectIdGuidValue); Assert.AreEqual(0, tracker.GetProjectLinks().Count()); Assert.IsTrue(targetVsHierarchy.GetPropertyProjectValue.Globals.set_VariablePersistsCalled); Assert.IsFalse(targetVsHierarchy.GetPropertyProjectValue.Globals.set_VariablePersistsArgumentValue); }
public void ShouldGetEmptyLinkedProjectList() { var solution = new MockIVsSolution(); TestableProjectLinkTracker tracker = new TestableProjectLinkTracker(new MockDocumentTracker(), solution); var projectLinks = tracker.GetProjectLinks(); Assert.IsNotNull(projectLinks); Assert.AreEqual(0, projectLinks.Count()); }