public void Run_multithreaded() { // WARNING! This test might fail if normal code execution runs extremely // slowly for whatever reason. At any rate, the total running time // of the test should be less than the sum of the time taken // by the slow file processors if (Environment.ProcessorCount < 2) { return; } string source = @"c:\bogus"; string target = @"d:\fake"; List <IExcelProcess> plugins = new List <IExcelProcess>(); IFileFinder ff = new MockFileFinder(2); SlowFileProcessor fp = new SlowFileProcessor(); ProcessorApp app = new ProcessorApp(source, target, plugins, ff, fp); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); app.Run(); stopWatch.Stop(); // Get the elapsed time as a TimeSpan value. TimeSpan ts = stopWatch.Elapsed; Assert.IsTrue(ts.Milliseconds < 150); }
public void Run_process_files() { string source = @"c:\bogus"; string target = @"d:\fake"; List <IExcelProcess> plugins = new List <IExcelProcess>(); IFileFinder ff = new MockFileFinder(3); MockFileProcessor fp = new MockFileProcessor(); ProcessorApp app = new ProcessorApp(source, target, plugins, ff, fp); app.Run(); Assert.AreEqual(3, fp.ProcessCalls); }