public Metadata( ILogger <Metadata> logger, IFileSystem fileSystem, FileMatcher fileMatcher, OutputRecordWriter writer, MetadataRegister register) { this.logger = logger; this.fileSystem = fileSystem; this.fileMatcher = fileMatcher; this.writer = writer; this.extractorRegister = register; }
public void OutputWriterWriteCsv() { var stringBuilder = new StringBuilder(4); using var stringWriter = new StringWriter(stringBuilder); var csvSerializer = new CsvSerializer(); var output = new OutputRecordWriter(stringWriter, csvSerializer); // generate a fake and write it to the stream var a = this.fakes.Recording.Generate(); output.Write(a); // check the header was written var actual = stringBuilder.ToString(); Assert.StartsWith($"{nameof(Recording.SourcePath)},", actual); Assert.Contains(a.ExpectedDurationSeconds?.TotalSeconds.ToString(), actual); // generate and write another fake var b = this.fakes.Recording.Generate(); output.Write(b); // finish writing output.Dispose(); actual = stringBuilder.ToString(); Assert.StartsWith($"{nameof(Recording.SourcePath)},", actual); Assert.Single(Regex.Matches(actual, $"{nameof(Recording.SourcePath)},")); Assert.Contains(a.ExpectedDurationSeconds?.TotalSeconds.ToString(), actual); var records = csvSerializer.Deserialize <Recording>(new StringReader(actual)).ToArray(); Assert.Equal(records[0].SourcePath, a.SourcePath); Assert.Equal(records[1].SourcePath, b.SourcePath); }
public void OutputWriterWriteJson() { var stringBuilder = new StringBuilder(4); using var stringWriter = new StringWriter(stringBuilder); var jsonSerializer = new JsonSerializer(); var output = new OutputRecordWriter(stringWriter, jsonSerializer); // generate a fake and write it to the stream var a = this.fakes.Recording.Generate(); output.Write(a); // check the header was written var actual = stringBuilder.ToString(); Assert.StartsWith($"[{Environment.NewLine}", actual); Assert.EndsWith("}", actual); // generate and write another fake var b = this.fakes.Recording.Generate(); output.Write(b); // finish writing output.Dispose(); actual = stringBuilder.ToString(); Assert.StartsWith($"[{Environment.NewLine}", actual); Assert.EndsWith("]", actual); var records = jsonSerializer.Deserialize <Recording>(new StringReader(actual)).ToArray(); Assert.Equal(records[0].SourcePath, a.SourcePath); Assert.Equal(records[1].SourcePath, b.SourcePath); }
public FixList(OutputRecordWriter writer) { this.Writer = writer; }
public FixApply(ILogger <FixApply> logger, ILogger <DryRun> dryRunLogger, FileMatcher fileMatcher, FixRegister register, OutputRecordWriter writer, IFileSystem fileSystem) { this.logger = logger; this.dryRunLogger = dryRunLogger; this.fileMatcher = fileMatcher; this.register = register; this.fileSystem = fileSystem; this.Writer = writer; }
public FixCheck(IConsole console, ILogger <FixCheck> logger, FileMatcher fileMatcher, FixRegister register, OutputRecordWriter writer, IFileSystem fileSystem) { this.console = console; this.logger = logger; this.fileMatcher = fileMatcher; this.register = register; this.fileSystem = fileSystem; this.Writer = writer; }
public Version(OutputRecordWriter writer) { this.Writer = writer; }
public Rename(ILogger <Rename> logger, ILogger <DryRun> dryRunLogger, IFileSystem fileSystem, FileMatcher fileMatcher, OutputRecordWriter writer, FilenameParser parser) { this.logger = logger; this.dryRunLogger = dryRunLogger; this.fileSystem = fileSystem; this.fileMatcher = fileMatcher; this.parser = parser; this.Writer = writer; this.fileSystem = fileSystem; this.fileSystem = fileSystem; }