private void BtnServiceSwitch_Click(object sender, EventArgs e) { try { if (lblServiceStatus.Text.ToLower() != "stopped") { _serviceController.Stop(); _serviceController.WaitForStatus(ServiceControllerStatus.Stopped); btnServiceSwitch.Text = "Start"; //lblServiceStatus.Text = "Stopped"; } else { _serviceController.Start(); _serviceController.WaitForStatus(ServiceControllerStatus.Running); btnServiceSwitch.Text = "Stop"; //lblServiceStatus.Text = "Running"; } lblServiceStatus.Text = _serviceController.Status.ToString(); } catch (Exception ex) { Logging.WriteLog(ex); _serviceController.Stop(); AuditLogAccess.Save(ex); } }
public void InsertAuditLogTest() { //Assign bool success = false; try { throw new Exception("Log Saving Test"); } catch (Exception ex) {//Act success = AuditLogAccess.Save(ex); } //Assert Assert.AreEqual(success, true); }