private static void InternalVerifyOpeningOfDocumentsWithoutExceptionStart(TestAllProjectsInFolderOptions testOptions, Altaxo.Main.Services.ExternalDrivenBackgroundMonitor monitor) { var reporter = new Reporter(testOptions, Current.Console); var oldOutputService = Current.GetService <Services.ITextOutputService>(); Current.RemoveService <Services.ITextOutputService>(); Current.AddService <Services.ITextOutputService>(reporter); if (!object.ReferenceEquals(Current.Console, reporter)) { throw new InvalidProgramException("Current console now should be the reporter! Please debug."); } var test = new TestAllProjectsInFolder(reporter, testOptions); Current.IProjectService.ProjectChanged += test.EhProjectChanged; try { test.InternalVerifyOpeningOfDocumentsWithoutException(testOptions, monitor); } catch (Exception ex) { reporter.WriteLine("Fatal error: Test has to close due to an unhandled exception. The exception details:"); reporter.WriteLine(ex.ToString()); } finally { Current.IProjectService.ProjectChanged += test.EhProjectChanged; reporter.WriteLine("----------------------- End of test ------------------------------------------"); reporter.Close(); Current.RemoveService <Services.ITextOutputService>(); Current.AddService <Services.ITextOutputService>(oldOutputService); } }
private static void InternalVerifyOpeningOfDocumentsWithoutExceptionStart(TestAllProjectsInFolderOptions testOptions, Altaxo.Main.Services.ExternalDrivenBackgroundMonitor monitor) { var reporter = new Reporter(testOptions, Current.Console); var oldOutputService = Current.SetOutputService(reporter); var test = new TestAllProjectsInFolder(reporter, testOptions); Current.ProjectService.ProjectChanged += test.EhProjectChanged; try { test.InternalVerifyOpeningOfDocumentsWithoutException(testOptions, monitor); } catch (Exception ex) { reporter.WriteLine("Fatal error: Test has to close due to an unhandled exception. The exception details:"); reporter.WriteLine(ex.ToString()); } finally { Current.ProjectService.ProjectChanged += test.EhProjectChanged; reporter.WriteLine("----------------------- End of test ------------------------------------------"); reporter.Close(); Current.SetOutputService(oldOutputService); } }