public void ShouldRespondWithFilesAndDirectoriesInAlphabeticalOrder() { // Arrange var path = "M:\\documents"; var stuffExeFile = FsFileTestDataBuilder.Create().WithName("stuff.exe").Build(); var gamesExeFile = FsFileTestDataBuilder.Create().WithName("games.exe").Build(); var files = new List <FsFile> { stuffExeFile, gamesExeFile }; var unconferenceDirectory = FsDirectoryTestDataBuilder.Create().WithName("unconference").Build(); var conferenceDirectory = FsDirectoryTestDataBuilder.Create().WithName("conference").Build(); var directories = new List <FsDirectory> { unconferenceDirectory, conferenceDirectory }; List <IFsItem> actualFsItems = null; var presenter = SubstituteFsItemPresenterBuilder.Create() .WithFsItemsSnapshot(f => actualFsItems = f) .Build(); var lsUseCase = CreateLsUseCase(path, files, directories); // Act lsUseCase.Execute(path, presenter); // Assert Expect(actualFsItems).To.Deep.Equal(new List <IFsItem> { conferenceDirectory, gamesExeFile, stuffExeFile, unconferenceDirectory }); }
public void WhenFilesNotInAlphabeticalOrder_ShouldRespondWithTheDirectoriesInAlphabeticalOrder() { // Arrange var path = "X:\\somewhere_else"; var notes = FsDirectoryTestDataBuilder.Create().WithName("notes").Build(); var zebras = FsDirectoryTestDataBuilder.Create().WithName("zebras").Build(); var memes = FsDirectoryTestDataBuilder.Create().WithName("memes").Build(); var books = FsDirectoryTestDataBuilder.Create().WithName("books").Build(); var directories = new List <FsDirectory> { notes, zebras, memes, books }; List <IFsItem> actualDirectories = null; var presenter = SubstituteFsItemPresenterBuilder.Create() .WithFsItemsSnapshot(f => actualDirectories = f) .Build(); var lsUseCase = CreateLsUseCase(path, directories); // Act lsUseCase.Execute(path, presenter); // Assert Expect(actualDirectories).To.Deep.Equal(new List <IFsItem> { books, memes, notes, zebras }); }
public void ShouldRespondWithTheDirectories() { // Arrange var path = "Z:\\"; var directories = new List <FsDirectory> { FsDirectoryTestDataBuilder.Create().WithName("cake recipes").Build(), FsDirectoryTestDataBuilder.Create().WithName("code").Build(), FsDirectoryTestDataBuilder.Create().WithName("talks").Build() }; List <IFsItem> actualDirectories = null; var presenter = SubstituteFsItemPresenterBuilder.Create() .WithFsItemsSnapshot(f => actualDirectories = f) .Build(); var lsUseCase = CreateLsUseCase(path, directories); // Act lsUseCase.Execute(path, presenter); // Assert Expect(actualDirectories).To.Deep.Equal(directories); }