public void should_convert_fieldnames_to_snakecase_recursively_through_lists() { const string valueToCheckFor = "valuetocheckfor"; var obj = new Dictionary <string, object> { { "Base", new[] { new Dictionary <string, object> { { "FieldName", valueToCheckFor } } } } }; var output = new List <ProcessedLogEvent>(); var logger = new Logger(logEvents => logEvents .Select(BasicFormatting.Process) .Select(FieldNameFormatting.ToSnakeCase()) .Subscribe(log => output.Add(log)) ); logger.Info(obj); var array = (IEnumerable <object>)output[0].Content.First().Value; var subObj = (Dictionary <string, object>)array.First(); var field = subObj.First(); Assert.Equal("field_name", field.Key); Assert.Equal(valueToCheckFor, field.Value); }
public void should_convert_fieldnames_to_snakecase(string originalFieldName, string finalFieldName) { const string valueToCheckFor = "valuetocheckfor"; var obj = new Dictionary <string, object> { { originalFieldName, valueToCheckFor } }; var output = new List <ProcessedLogEvent>(); var logger = new Logger(logEvents => logEvents .Select(BasicFormatting.Process) .Select(FieldNameFormatting.ToSnakeCase()) .Subscribe(log => output.Add(log)) ); logger.Info(obj); var field = output[0].Content.First(); Assert.Equal(finalFieldName, field.Key); Assert.Equal(valueToCheckFor, field.Value); }