protected void GivenFileDeleteSucceeds(string filePath) { LogShipperFileManager.Setup(x => x.LockAndDeleteFile(filePath)).Callback((string file) => { LogFiles = LogFiles.Where(x => !string.Equals(x, file, StringComparison.OrdinalIgnoreCase)).ToArray(); }); }
protected void GivenLogFilesInDirectory(int files = 5) { LogFiles = Fixture.CreateMany <string>(files) .Select(x => Path.Combine(LogFolder, LogFileNamePrefix + x + ".json")) .OrderBy(x => x) .ToArray(); LogShipperFileManager .Setup(x => x.GetFiles( It.Is <string>(s => s == LogFolder), It.Is <string>(s => s == LogFileNamePrefix + "*.json") ) ) .Returns(() => LogFiles); }
protected void GivenLockedFileLength(string logFileName, long length) { LogShipperFileManager .Setup(x => x.GetFileLengthExclusiveAccess(logFileName)) .Returns(length); }
protected void GivenFileCannotBeLocked(string logFileName) { LogShipperFileManager .Setup(x => x.GetFileLengthExclusiveAccess(logFileName)) .Throws <IOException>(); }