public void GetLoggerWithConfiguration_IfConfigurationIsNull_Throws() { // Arrange HttpConfiguration configuration = null; // Act & Assert Assert.ThrowsArgumentNull(() => ExceptionServices.GetLogger(configuration), "configuration"); }
public void GetLoggerWithServices_IfServicesIsNull_Throws() { // Arrange ServicesContainer services = null; // Act & Assert Assert.ThrowsArgumentNull(() => ExceptionServices.GetLogger(services), "services"); }
public void GetLoggerWithConfiguration_ReturnsCompositeExceptionLoggerWithServicesLoggers() { // Arrange IExceptionLogger expectedLogger = CreateDummyLogger(); using (HttpConfiguration configuration = CreateConfiguration(expectedLogger)) { // Act IExceptionLogger logger = ExceptionServices.GetLogger(configuration); // Assert IEnumerable <IExceptionLogger> loggers = Assert.IsType <CompositeExceptionLogger>(logger).Loggers; IExceptionLogger actualLogger = Assert.Single(loggers); Assert.Same(expectedLogger, actualLogger); } }
public void GetLoggerWithServices_ReturnsSameInstance() { // Arrange IExceptionLogger innerLogger = CreateDummyLogger(); using (ServicesContainer services = CreateServices(innerLogger)) { IExceptionLogger firstLogger = ExceptionServices.GetLogger(services); // Act IExceptionLogger secondLogger = ExceptionServices.GetLogger(services); // Assert Assert.Same(firstLogger, secondLogger); } }
public void GetLoggerWithServices_ReturnsCompositeExceptionLoggerWithServicesLoggers() { // Arrange IExceptionLogger expectedLogger = CreateDummyLogger(); using (ServicesContainer services = CreateServices(expectedLogger)) { // Act IExceptionLogger logger = ExceptionServices.GetLogger(services); // Assert IEnumerable <IExceptionLogger> loggers = Assert.IsType <CompositeExceptionLogger>(logger).Loggers; IExceptionLogger actualLogger = Assert.Single(loggers); Assert.Same(expectedLogger, actualLogger); } }