public void TestInputFileLine(string filename, InputFileMode mode) { FileReadLine fl = new FileReadLine() { Filename = filename }; int caller = 0; if (mode == InputFileMode.LineByLine) { fl.Output.Select(s => new ContentSchema <string>() { Content = s }).Subscribe(s => { Debug.WriteLine($"{++caller}-{s.Content.ToString()}"); }, () => { Assert.AreEqual(caller, 349); }); } if (mode == InputFileMode.Full) { fl.Output.Aggregate("", (a, b) => $"{a}\n{b}").Select(s => new ContentSchema <string>() { Content = s }).Subscribe(s => { Debug.WriteLine($"{++caller}-{s.Content.ToString()}"); }, () => { Assert.AreEqual(caller, 1); }); } }
public async Task TestInputFileLineTestOpenFileETL(string filename, InputFileMode mode) { var inputFileService = ctx.GetService <TInputFile>(); Assert.IsNotNull(inputFileService); inputFileService.RegisterComponentForEvents(scheduler); inputFileService.Filename = filename; inputFileService.Mode = mode; inputFileService.AddToJob(job); int caller = 0; if (mode == InputFileMode.LineByLine) { inputFileService.OnOutput.Subscribe(s => { ++caller; //Debug.WriteLine($"{++caller}-{s.Content.ToString()}"); }, () => { Assert.AreEqual(caller, 349); }); var logRow = ctx.GetService <TLogRow <ContentSchema <string> > >(); Assert.IsNotNull(logRow); logRow.ShowHeader = true; logRow.ShowItemNumber = true; logRow.Mode = TLogRowMode.Table; logRow.RegisterComponentForEvents(scheduler); logRow.AddInput(job, inputFileService.OnOutput); } if (mode == InputFileMode.Full) { inputFileService.OnOutput.Subscribe(s => { Debug.WriteLine($"{++caller}-{s.Content.ToString()}"); }, () => { Assert.AreEqual(caller, 1); }); } //scheduler.Start(); await job.Start(); }