예제 #1
0
 private static void LogErrors(EasyTest easyTest, Exception e)
 {
     lock (_locker) {
         var directoryName = Path.GetDirectoryName(easyTest.FileName) + "";
         string fileName = Path.Combine(directoryName, "config.xml");
         using (var optionsStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) {
             Options options = Options.LoadOptions(optionsStream, null, null, directoryName);
             var logTests = new LogTests();
             foreach (var application in options.Applications.Cast<TestApplication>()) {
                 var logTest = new LogTest { ApplicationName = application.Name, Result = "Failed" };
                 var logError = new LogError { Message = { Text = e.ToString() } };
                 logTest.Errors.Add(logError);
                 logTests.Tests.Add(logTest);
             }
             logTests.Save(Path.Combine(directoryName, "TestsLog.xml"));
         }
     }
     Trace.TraceError(e.ToString());
 }
예제 #2
0
 static void Main(string[] args)
 {
     LogTests.Test(args);
     new CombinedTests().ComplexLogFromTryCatch();
     new CombinedTests().AsyncLogWithError().Wait();
 }