示例#1
0
        public void ConstructorWithPropertiesArgument_WithInvalidConfiguration_ThrowsException()
        {
            // Arrange
            var invalidConfiguration = (new ConfigurationBuilder()).Build();

            using (var manager = new CommonLoggingTestLoggingAppDomainManager(invalidConfiguration))
            {
                // Act
                manager.DomainUnderTest.CallConstructorWithPropertiesArgument();
            }
        }
示例#2
0
        public void ConstructorWithPropertiesArgument_WithValidConfiguration_Succeeds()
        {
            // Arrange
            var validConfiguration = BuildValidConfiguration();

            using (var manager = new CommonLoggingTestLoggingAppDomainManager(validConfiguration))
            {
                // Act
                manager.DomainUnderTest.CallConstructorWithPropertiesArgument();
            }
        }
示例#3
0
        public void Constructor_WithValidConfiguration_Succeeds()
        {
            // Arrange
            var validConfiguration = BuildValidConfiguration();

            using (var manager = new CommonLoggingTestLoggingAppDomainManager(validConfiguration))
            {
                // Act
                manager.DomainUnderTest.CallDefaultConstructor();
            }
        }
示例#4
0
        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);
            }
        }
示例#5
0
        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);
            }
        }
示例#6
0
        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);
            }
        }