コード例 #1
0
        public void PARSER_SHOULD_NOT_ADD_PROPERTIES_WHEN_NOT_REQUIRED()
        {
            //Arrange
            var loggingEvent = new LoggingEvent(new LoggingEventData());

            loggingEvent.Properties["prop"] = "prop";
            var parser           = new BasicLoggingEventParser(string.Empty, FixFlags.None, false, _exceptionFactory);
            var resultDictionary = new Dictionary <string, object>();

            //Act
            parser.ParseProperties(loggingEvent, resultDictionary);

            //Assert
            resultDictionary.ContainsKey("prop").Should().BeFalse();
        }
コード例 #2
0
        public void PARSER_SHOULD_ADD_ALL_PROPERTIES_WHEN_REQUIRED(int numOfProperties)
        {
            //Arrange
            var loggingEvent = new LoggingEvent(new LoggingEventData());

            for (var i = 0; i < numOfProperties; i++)
            {
                loggingEvent.Properties["property" + i] = i;
            }
            var parser           = new BasicLoggingEventParser(string.Empty, FixFlags.Properties, false, _exceptionFactory);
            var resultDictionary = new Dictionary <string, object>();

            //Act
            parser.ParseProperties(loggingEvent, resultDictionary);

            //Assert
            var loggingEventProperties = loggingEvent.Properties;

            foreach (var key in loggingEventProperties.GetKeys())
            {
                resultDictionary[key].Should().Be(loggingEventProperties[key]);
            }
        }