public void ShouldDispatchRenameFilesToSyncher() { TestableProjectLinkTracker tracker = new TestableProjectLinkTracker(new MockDocumentTracker(), new MockIVsSolution()); var project1 = new MockVsHierarchy(); var project2 = new MockVsHierarchy(); MockProjectItemsSyncer syncher = new MockProjectItemsSyncer(project1.GetPropertyProjectValue, project2.GetPropertyProjectValue); tracker.AddProjectSyncer(syncher); tracker.OnAfterRenameFiles(1, 2, new[] { project1 }, new[] { 0 }, new[] { "oldFileName", "oldDirectoryName" }, new[] { "newFileName", "newDirectoryName" }, new[] { VSRENAMEFILEFLAGS.VSRENAMEFILEFLAGS_NoFlags, VSRENAMEFILEFLAGS.VSRENAMEFILEFLAGS_Directory }); Assert.IsTrue(syncher.FilesRenamedInSourceCalled); }
public void ShouldDispatchOnlyToMatchingSynchers() { TestableProjectLinkTracker tracker = new TestableProjectLinkTracker(new MockDocumentTracker(), new MockIVsSolution()); var project1 = new MockVsHierarchy(); var project2 = new MockVsHierarchy(); var project3 = new MockVsHierarchy(); MockProjectItemsSyncer syncherMatching = new MockProjectItemsSyncer(project1.GetPropertyProjectValue, project2.GetPropertyProjectValue); MockProjectItemsSyncer syncherNonMatching = new MockProjectItemsSyncer(project3.GetPropertyProjectValue, project2.GetPropertyProjectValue); tracker.AddProjectSyncer(syncherMatching); tracker.AddProjectSyncer(syncherNonMatching); tracker.OnAfterAddFilesEx(1, 1, new[] { project1 }, new[] { 0 }, new[] { "File1.txt" }, new[] { VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags }); Assert.IsTrue(syncherMatching.FilesAddedToSourceCalled); Assert.IsFalse(syncherNonMatching.FilesAddedToSourceCalled); }
public void ShouldDispatchRemoveToSyncher() { TestableProjectLinkTracker tracker = new TestableProjectLinkTracker(new MockDocumentTracker(), new MockIVsSolution()); var project1 = new MockVsHierarchy(); var project2 = new MockVsHierarchy(); MockProjectItemsSyncer syncher = new MockProjectItemsSyncer(project1.GetPropertyProjectValue, project2.GetPropertyProjectValue); tracker.AddProjectSyncer(syncher); tracker.OnAfterRemoveFiles(1, 1, new[] { project1 }, new[] { 0 }, new[] { "File1.txt" }, new[] { VSREMOVEFILEFLAGS.VSREMOVEFILEFLAGS_NoFlags }); Assert.IsTrue(syncher.FilesRemovedFromSourceCalled); }
public void ShouldDispatchAddDirectoriesToSyncher() { TestableProjectLinkTracker tracker = new TestableProjectLinkTracker(new MockDocumentTracker(), new MockIVsSolution()); var project1 = new MockVsHierarchy(); var project2 = new MockVsHierarchy(); MockProjectItemsSyncer syncher = new MockProjectItemsSyncer(project1.GetPropertyProjectValue, project2.GetPropertyProjectValue); tracker.AddProjectSyncer(syncher); tracker.OnAfterAddDirectoriesEx(1, 1, new[] { project1 }, new[] { 0 }, new[] { "Myfolder" }, new[] { VSADDDIRECTORYFLAGS.VSADDDIRECTORYFLAGS_NoFlags }); Assert.IsTrue(syncher.DirectoriesAddedToSourceCalled); }