private void btn_guardar_logs_Click(object sender, EventArgs e) { _CJobLogger.IfJobLogger.LogToDatabase = false; try { _CJobLogger.LogMessage("test message", Enumerations.LogType.message); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void ExceptionTypeMessageMustBeEspecified() { try { CJobLogger _jobLogger = new CJobLogger(new DJobLogger(false, false, false, true, true, true)); _jobLogger.LogMessage("test", Enumerations.LogType.message); } catch (Exception ex) { Assert.AreEqual(ex.Message, "Error or Warning or Message must be specified"); return; } Assert.Fail("No exception was thrown"); }
public void ExceptionTypeWasntConfiguredToSaveError() { try { CJobLogger _jobLogger = new CJobLogger(new DJobLogger(true, true, true, true, true, false)); _jobLogger.LogMessage("test", Enumerations.LogType.error); } catch (Exception ex) { Assert.AreEqual(ex.Message, "JobLogger is not configured to save this type of log"); return; } Assert.Fail("No exception was thrown"); }
public void ExceptionMessageCantBeNullEmpty() { try { CJobLogger _jobLogger = new CJobLogger(new DJobLogger()); _jobLogger.LogMessage(null, Enumerations.LogType.message); } catch (Exception ex) { Assert.AreEqual(ex.Message, "Message can't be null or empty"); return; } Assert.Fail("No exception was thrown"); }