public void LogException(BarberException exception) { using (IDocumentSession session = _documentStore.OpenSession()) { session.Store(exception); session.SaveChanges(); } }
public void Add_Adds_Customer_To_Store() { var exception = new BarberException(); _repository.LogException(exception); Received.InOrder(() => { _defaultSession.Store(exception); _defaultSession.SaveChanges(); _defaultSession.Dispose(); }); }
public void Handles_Exceptions() { var barberException = new BarberException(); var exceptionLogged = false; _logger.When(l => l.LogException(barberException)).Do(_ => { exceptionLogged = true; throw new Exception(); }); Assert.DoesNotThrow(() => BarberLogManager.Logger.LogException(barberException)); Assert.IsTrue(exceptionLogged); }
/// <summary> /// Exception handling /// </summary> /// <param name="exception"></param> public void LogException(BarberException exception) { EventLog.WriteEntry(_source, exception.ToString()); }