public void ShouldReturnNoItemsIfFolderDoesNotExist() { // Arrange var solutionManager = new MockSolutionManagerBuilder(new MockProject("myProj", new MockFolder("someFolder", new MockFolder("childFolder", new MockItem("someFile")) ) )).Build(); // Act var results = new GetProjectFolderCmdlet(solutionManager, null) { Path = "someFolder\\nonExistent\\anotherNonExistent" }.GetResults <ProjectItems>(); // Assert Assert.AreEqual(0, results.Count()); }
public void ShouldCreateFolderChainIfRequested() { // Arrange var solutionManager = new MockSolutionManagerBuilder(new MockProject("myProj", new MockFolder("someFolder") ) { RootPath = "proj:\\root" }).Build(); var mockFileSystem = new Mock <IFileSystem>(); // Act var results = new GetProjectFolderCmdlet(solutionManager, mockFileSystem.Object) { Path = "someFolder\\newFolder\\anotherNewFolder", Create = new SwitchParameter(true) }.GetResults <ProjectItems>(); // Assert Assert.AreEqual(1, results.Count()); Assert.AreEqual("anotherNewFolder", ((ProjectItem)results.Single().Parent).Name); mockFileSystem.Verify(x => x.CreateDirectory("proj:\\root\\someFolder\\newFolder\\anotherNewFolder")); }