public SizeBasedRollingStrategy(IFileSystem fileSystem, IFileSuffixFormatter <int> suffixFormatter, ISizeBasedRoller sizeBasedRoller, Func <char> suffixSeparatorProvider) { this.sizeBasedRoller = sizeBasedRoller; this.fileSystem = fileSystem; this.suffixFormatter = suffixFormatter; this.suffixSeparatorProvider = suffixSeparatorProvider; }
public void TestSetup() { fileSystem = Substitute.For <IFileSystem>(); fileSystem.GetFilesByPrefix("logs/log").Returns(new FilePath[] { "logs/log-3", "logs/log-1", "logs/log-2" }); var suffixFormatter = Substitute.For <IFileSuffixFormatter <int> >(); suffixFormatter.FormatSuffix(Arg.Any <int>()).Returns(callInfo => callInfo.Arg <int>().ToString()); suffixFormatter.TryParseSuffix(Arg.Any <string>()).Returns(callInfo => int.TryParse(callInfo.Arg <string>(), out var p) ? p : null as int?); roller = Substitute.For <ISizeBasedRoller>(); strategy = new SizeBasedRollingStrategy(fileSystem, suffixFormatter, roller, () => '-'); }
public SizeBasedRollingStrategy(IFileSystem fileSystem, IFileSuffixFormatter <int> suffixFormatter, ISizeBasedRoller sizeBasedRoller) { this.sizeBasedRoller = sizeBasedRoller; this.fileSystem = fileSystem; this.suffixFormatter = suffixFormatter; }