public void ConstructorWithPropertiesArgument_WithInvalidConfiguration_ThrowsException() { // Arrange var invalidConfiguration = (new ConfigurationBuilder()).Build(); using (var manager = new CommonLoggingTestLoggingAppDomainManager(invalidConfiguration)) { // Act manager.DomainUnderTest.CallConstructorWithPropertiesArgument(); } }
public void ConstructorWithPropertiesArgument_WithValidConfiguration_Succeeds() { // Arrange var validConfiguration = BuildValidConfiguration(); using (var manager = new CommonLoggingTestLoggingAppDomainManager(validConfiguration)) { // Act manager.DomainUnderTest.CallConstructorWithPropertiesArgument(); } }
public void Constructor_WithValidConfiguration_Succeeds() { // Arrange var validConfiguration = BuildValidConfiguration(); using (var manager = new CommonLoggingTestLoggingAppDomainManager(validConfiguration)) { // Act manager.DomainUnderTest.CallDefaultConstructor(); } }
public void GetLogger_WithNameWithoutExactMatch_ReturnsExpectedParentProvider() { // Arrange const string HierarchicalLoggerName = "System.Configuration.Install"; const string ExpectedLoggerName = "System.Configuration"; var validConfiguration = BuildConfigurationWithProviderNames("System", ExpectedLoggerName, "System.Configuration.FooBar"); using (var manager = new CommonLoggingTestLoggingAppDomainManager(validConfiguration)) { // Act string actualLoggerName = manager.DomainUnderTest.GetLoggerName(HierarchicalLoggerName); // Assert Assert.AreEqual(ExpectedLoggerName, actualLoggerName); } }
public void GetLogger_WithNameThatDoesNotMatchAnyHierarchicalParents_ReturnsDefaultProvider() { // Arrange const string HierarchicalLoggerName = "CuttingEdge.Logging"; const string ExpectedLoggerName = "DefaultLogger"; var validConfiguration = BuildConfigurationWithProviderNames(ExpectedLoggerName, "Logging"); using (var manager = new CommonLoggingTestLoggingAppDomainManager(validConfiguration)) { // Act string actualLoggerName = manager.DomainUnderTest.GetLoggerName(HierarchicalLoggerName); // Assert Assert.AreEqual(ExpectedLoggerName, actualLoggerName); } }
public void GetLogger_WithNameWithoutExactMatchConfigurationInDifferentOrder_ReturnsExpectedParentProvider() { // Arrange const string HierarchicalLoggerName = "System.Configuration.Install.FooBar"; const string ExpectedLoggerName = "System.Configuration.Install"; // This test looks a lot like the previous, but the providers are in a different order now. var validConfiguration = BuildConfigurationWithProviderNames( "System.Configuration.FooBar", "System.Configuration", ExpectedLoggerName, "System"); using (var manager = new CommonLoggingTestLoggingAppDomainManager(validConfiguration)) { // Act string actualLoggerName = manager.DomainUnderTest.GetLoggerName(HierarchicalLoggerName); // Assert Assert.AreEqual(ExpectedLoggerName, actualLoggerName); } }