示例#1
0
        public void ConfigurationCannotBeAppliedTwice()
        {
            // arrange
            var serilogConfigurationDummy = new Mock <LoggerConfiguration>();
            var sut    = new ConsoleLoggingConfiguration();
            var action = new Action(() => sut.Apply(serilogConfigurationDummy.Object));

            sut.Apply(serilogConfigurationDummy.Object);

            // act
            // assert
            action.ShouldThrow <InvalidOperationException>();
        }
示例#2
0
        public void ConfigurationCannotBeAppliedTwice()
        {
            // arrange
            StringExtensions.ConfigurationLocation = Assembly.GetExecutingAssembly().Location;
            var serilogConfigurationDummy = new Mock <LoggerConfiguration>();
            var sut    = new ConsoleLoggingConfiguration();
            var action = new Action(() => sut.Apply(serilogConfigurationDummy.Object));

            sut.Apply(serilogConfigurationDummy.Object);

            // act
            // assert
            action.Should().Throw <InvalidOperationException>();
        }
示例#3
0
        public void ApplyLoggingConfiguration(bool isUsed, bool isActive, bool wasApplied)
        {
            // arrange
            ApplicationConfigurationHelper.AdjustKeys("log.console", isUsed.ToString());
            var serilogConfigurationDummy = new Mock <LoggerConfiguration>();
            var sut = new ConsoleLoggingConfiguration();

            // act
            sut.Apply(serilogConfigurationDummy.Object);

            // assert
            sut.LogToConsole.Should().Be(isUsed);
            sut.IsActive.Should().Be(isActive);
            sut.WasApplied.Should().Be(wasApplied);
        }