public NameSorterFileUtilsMock(NameSorterLinesProcess process, String testFileName, List <String> lines) { Process = process; TestFileName = testFileName; Lines = lines; LastLinesWritten = null; }
public NameSorterProcess(String fileName, IExecutionState executionState) { FileName = fileName; NameDetailsLineBuilder = new NameDetailsLineBuilder(); NameSortProcess = new NameSortProcess(); Process = new NameSorterLinesProcess(NameDetailsLineBuilder); FileUtils = new NameSorterFileUtils(Process); ExecutionState = executionState; }
public void RunEndToEndProcess1() { String expectedLine1 = "Mad as a hatter Max"; String expectedLine2 = "Modonna Smith"; String expectedLine3 = "John Snow"; List <String> fileContent = new List <String>(); fileContent.Add(expectedLine3); fileContent.Add(expectedLine1); fileContent.Add(expectedLine2); NameSorterLinesProcess process = new NameSorterLinesProcess(nameDetailsLineBuilder); NameSorterFileUtilsMock fileUtils = new NameSorterFileUtilsMock(process, "test1.txt", fileContent); NameSorterScreenUtils screenUtils = new NameSorterScreenUtils(nameDetailsLineBuilder); ExecutionStateMock stateMock = new ExecutionStateMock(); NameSorterCommand command = new NameSorterCommand(fileUtils, screenUtils, stateMock); command.run("test1.txt", "test1.done.txt"); List <String> linesWritten = fileUtils.LastLinesWritten; Assert.Equal(3, linesWritten.Count); String line1 = linesWritten[0]; Assert.Equal(expectedLine1, line1); String line2 = linesWritten[1]; Assert.Equal(expectedLine2, line2); String line3 = linesWritten[2]; Assert.Equal(expectedLine3, line3); }
public NameSorterFileUtils(NameSorterLinesProcess lineProcess) { LinesProcess = lineProcess; }