public void RemoveDirectoryWithEmptySubFolderShouldDeleteWholeFolderStructure()
        {
            MockProject     sourceProject = new MockProject(@"c:\mockPath1\project1.csproj");
            MockProject     targetProject = new MockProject();
            MockProjectItem folder        = new MockProjectItem("MyFolder")
            {
                Kind = Constants.vsProjectItemKindPhysicalFolder
            };
            MockProjectItem subFolder = new MockProjectItem("EmptySubFolder")
            {
                Kind = Constants.vsProjectItemKindPhysicalFolder
            };

            folder.ProjectItems.AddProjectItem(subFolder);
            targetProject.ProjectItems.AddProjectItem(folder);

            string sourceFolder = Path.Combine(@"c:\mockPath1", @"MyFolder");
            ProjectItemsSynchronizer syncher = new ProjectItemsSynchronizer(sourceProject, targetProject, new MockLogger(), null, new MockProjectItemsFilter());

            Assert.AreEqual(1, targetProject.ProjectItems.Count);

            syncher.DirectoryRemovedFromSource(sourceFolder);

            Assert.IsTrue(folder.DeleteCalled);
        }
        public void ShouldRemoveLinkedFolderWhenDeletingFolderFromSource()
        {
            MockLogger      mockLogger    = new MockLogger();
            MockProject     sourceProject = new MockProject(@"c:\mockPath1\project1.csproj");
            MockProject     targetProject = new MockProject();
            MockProjectItem folder        = new MockProjectItem("MyFolder")
            {
                Kind = Constants.vsProjectItemKindPhysicalFolder
            };

            targetProject.ProjectItems.AddProjectItem(folder);

            string sourceFolder = Path.Combine(@"c:\mockPath1", @"MyFolder");
            ProjectItemsSynchronizer syncher = new ProjectItemsSynchronizer(sourceProject, targetProject, mockLogger, null, new MockProjectItemsFilter());

            Assert.AreEqual(1, targetProject.ProjectItems.Count);

            syncher.DirectoryRemovedFromSource(sourceFolder);

            Assert.IsTrue(folder.DeleteCalled);
            Assert.AreEqual(1, mockLogger.MessageLog.Count);
            StringAssert.Contains(mockLogger.MessageLog[0], "removed");
            StringAssert.Contains(mockLogger.MessageLog[0], @"MyFolder");
            StringAssert.Contains(mockLogger.MessageLog[0], targetProject.Name);
        }