public void ReportingMmfExtractorTest() { MmfExtractor extractor = new MmfExtractor(); PipelineContext pipelineContext = new PipelineContext() { FirstLineContainsHeaders = false, SourceFilePath = @"..\..\..\D2S.LibraryTests\ExtractorTests.txt" }; ManualResetEvent pause = new ManualResetEvent(true); BoundedConcurrentQueu <string[]> output = new BoundedConcurrentQueu <string[]>(); Progress <int> prog = new Progress <int>(); var action = extractor.GetPausableReportingWorkItem(); action(pipelineContext, output, pause, prog); Assert.IsTrue(output.Count == 3); List <string> ResultList = new List <string>(); for (int i = 0; i < 3; i++) { string[] s; output.TryTake(out s); ResultList.Add(s[0]); } Console.WriteLine(ResultList[0]); Console.WriteLine("This is a line"); Assert.IsTrue(ResultList[0].Normalize().Equals("This is a line", StringComparison.InvariantCulture)); }
public void PausingMmfExtractorTest() { MmfExtractor extractor = new MmfExtractor(); PipelineContext pipelineContext = new PipelineContext() { FirstLineContainsHeaders = false, SourceFilePath = @"..\..\..\D2S.LibraryTests\ExtractorTests.txt", Delimiter = " " }; ManualResetEvent pause = new ManualResetEvent(true); BoundedConcurrentQueu <string[]> output = new BoundedConcurrentQueu <string[]>(); //fun fact: this extractor gives zero f's about the amount of columns per row so were gonna try with a space delimiter. var action = extractor.GetPausableWorkItem(); action(pipelineContext, output, pause); Assert.IsTrue(output.Count == 3); List <string[]> ResultList = new List <string[]>(); for (int i = 0; i < 3; i++) { string[] s; output.TryTake(out s); ResultList.Add(s); } if (ResultList[0][0].Equals("This", StringComparison.InvariantCulture)) { Assert.IsTrue(true); } else { Assert.Fail(); } }