public void Log() { var mockContextLogger = new Mock <IContextExceptionLogger>(); var logger = new GoogleExceptionLogger(mockContextLogger.Object); logger.Log(_exception, _context); mockContextLogger.Verify(lb => lb.Log(_exception, It.IsAny <HttpContextWrapper>())); }
public void Log() { var mockAccessor = new Mock <IHttpContextAccessor>(); var mockContextLogger = new Mock <IContextExceptionLogger>(); var logger = new GoogleExceptionLogger(mockContextLogger.Object, mockAccessor.Object); logger.Log(_exception, new DefaultHttpContext()); mockContextLogger.Verify(lb => lb.Log(_exception, It.IsAny <HttpContextWrapper>())); }
public void Log_NullContext() { var mockContextLogger = new Mock <IContextExceptionLogger>(); var logger = new GoogleExceptionLogger(mockContextLogger.Object); HttpContext.Current = null; logger.Log(_exception); mockContextLogger.Verify(lb => lb.Log(_exception, It.IsAny <HttpContextWrapper>())); }
public void Log_NoContext_NoAccessorContext() { var mockAccessor = new Mock <IHttpContextAccessor>(); mockAccessor.Setup(a => a.HttpContext).Returns <DefaultHttpContext>(null); var mockContextLogger = new Mock <IContextExceptionLogger>(); var logger = new GoogleExceptionLogger(mockContextLogger.Object, mockAccessor.Object); logger.Log(_exception); mockContextLogger.Verify(lb => lb.Log(_exception, It.IsAny <HttpContextWrapper>())); }