Exemple #1
0
 public void LogException(BarberException exception)
 {
     using (IDocumentSession session = _documentStore.OpenSession())
     {
         session.Store(exception);
         session.SaveChanges();
     }
 }
Exemple #2
0
        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);
        }
Exemple #4
0
 /// <summary>
 /// Exception handling
 /// </summary>
 /// <param name="exception"></param>
 public void LogException(BarberException exception)
 {
     EventLog.WriteEntry(_source, exception.ToString());
 }