public void GetInfoLinesShouldThrowExceptionIfFileDoesntExists() { var fslMock = new Mock <IFilesystemLayer>(); fslMock.Setup(m => m.GetStringLinesOfFile(It.IsAny <string>())).Throws(new FileSystemLayerFileNotFoundException()); Mock <ILogFileNameProvider> lfnp = SetupLFNPMock(); var lfg = new LogFileGatherer(fslMock.Object, lfnp.Object); var result = lfg.GetInfoLinesFromLog("dummy"); }
public void GetInfoLinesShouldReturnEmptyListIfInputIsEmpty() { var fslMock = new Mock <IFilesystemLayer>(); fslMock.Setup(m => m.GetStringLinesOfFile(It.IsAny <string>())).Returns(new string[] {}); Mock <ILogFileNameProvider> lfnp = SetupLFNPMock(); var lfg = new LogFileGatherer(fslMock.Object, lfnp.Object); var result = lfg.GetInfoLinesFromLog("dummy"); Assert.IsInstanceOfType(result, typeof(List <string>)); Assert.IsTrue(result.Count == 0); }
public void GetInfoLinesShouldConvertInputIntoList() { var fslMock = new Mock <IFilesystemLayer>(); const string line1 = "line1"; const string line2 = "line2"; fslMock.Setup(m => m.GetStringLinesOfFile(It.IsAny <string>())).Returns(new string[] { line1, line2 }); Mock <ILogFileNameProvider> lfnp = SetupLFNPMock(); var lfg = new LogFileGatherer(fslMock.Object, lfnp.Object); var result = lfg.GetInfoLinesFromLog("dummy"); Assert.IsInstanceOfType(result, typeof(List <string>)); Assert.IsTrue(result.Count == 2); Assert.AreEqual(result[0], line1); Assert.AreEqual(result[1], line2); }
public LogInfoGatherer(FilesystemLayer.IFilesystemLayer fsl, ILogFileNameProvider _lfnp) { _fsl = fsl; _lfg = new LogFileGatherer(fsl, _lfnp); _il2fi = new LogFileLinesFileInfoConverter(new LogLinesToFileInfoConverter()); }