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>(); }
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>(); }
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); }