public static void SetupClass(TestContext context) { //publish database first by running the batch file; comment this out if already published and no further updates var p = new Process(); var startInfo = new ProcessStartInfo { WorkingDirectory = ".\\..\\..\\..\\", FileName = "PublishSampleDb.bat", CreateNoWindow = false, }; p.StartInfo = startInfo; p.Start(); p.WaitForExit(); //reset mef (settings) in case the other test classes used it and initialized its static data in a specific way new Mef(); //setup logger (resolve) Log = LogResolver.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); if (Log == null) { Assert.Fail("Logger not found. Check configuration."); } Log.Debug("Unit Test Class SETUP OK"); }
static EntityMapper() { try { Log = LogResolver.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); }catch (Exception e) { WriteLine($"Logger could not be resolved. Will continue without logging. INitialization exception: {e.Message}"); } }
private static ILogger ResolveLogger() { try { return(LogResolver.GetLogger(MethodBase.GetCurrentMethod().DeclaringType)); } catch (Exception e) { Debug.WriteLine($"Logger could not be resolved. Will continue without logging. INitialization exception: {e.Message}"); } return(default);
static CacheManager() { try { Log = LogResolver.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } catch (Exception ex) { Debug.WriteLine($"No logger implementation found. Will not log details. {ex.Message}"); } }
static ExecuteMethodTemplates() { try { Logger = LogResolver.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } catch (Exception e) { Debug.WriteLine($"Logger could not be resolved. Will continue without logging. INitialization exception: {e.Message}"); } }