示例#1
0
        public void CanDuckTypeLoggingConfigurationLegacyInLegacyNlog()
        {
            var instance = new LoggingConfiguration();

            instance.DuckCast <LoggingConfigurationLegacyProxy>();
            instance.TryDuckCast(out LoggingConfigurationLegacyProxy duck).Should().BeTrue();
            duck.Should().NotBeNull();
            duck.ConfiguredNamedTargets.Should().BeEmpty();
        }
示例#2
0
        public void CanDuckTypeLoggingConfigurationInModernNlog()
        {
            var instance = new LoggingConfiguration();

            instance.DuckCast <ILoggingConfigurationProxy>();
            instance.TryDuckCast(out ILoggingConfigurationProxy duck).Should().BeTrue();
            duck.Should().NotBeNull();
            duck.ConfiguredNamedTargets.Cast <object>().Should().BeEmpty();
        }
示例#3
0
        public void CanDuckTypeLoggingConfigurationLegacyPre43InAncientNlog()
        {
            var instance = new LoggingConfiguration();

            instance.LoggingRules.Should().BeEmpty();
            instance.DuckCast <LoggingConfigurationPre43Proxy>();
            instance.TryDuckCast(out LoggingConfigurationPre43Proxy duck).Should().BeTrue();
            duck.Should().NotBeNull();
            duck.ConfiguredNamedTargets.Should().BeEmpty();
            var rule = new LoggingRule();

            duck.LoggingRules.Add(rule);
            instance.LoggingRules.Should().ContainSingle().Which.Should().Be(rule);
        }