LogPropertiesTests.cs (55)
41LogPropertiesSimpleExtensions.LogFunc(_logger, "Hello", props);
43Assert.Equal(1, _logger.Collector.Count);
45var ss = _logger.LatestRecord.StructuredState!.ToDictionary(x => x.Key, x => x.Value);
60LogPropertiesOmitParameterNameExtensions.M0(_logger, props);
62var state = _logger.LatestRecord.StructuredState!;
77LogPropertiesOmitParameterNameExtensions.M2(_logger, LogLevel.Critical, props);
79var state = _logger.LatestRecord.StructuredState!;
116LogPropertiesSpecialTypesExtensions.M0(_logger, props);
117var state = _logger.LatestRecord.StructuredState!;
227LogFunc(_logger, StringProperty, classToLog);
228Assert.Equal(1, _logger.Collector.Count);
229Assert.Equal(LogLevel.Debug, _logger.Collector.LatestRecord.Level);
293_logger.Collector.LatestRecord.StructuredState.Should().NotBeNull().And.Equal(expectedState);
300LogMethodTwoParams(_logger, StringProperty, classToLog);
301Assert.Equal(1, _logger.Collector.Count);
302Assert.Equal(LogLevel.Information, _logger.Collector.LatestRecord.Level);
303Assert.Equal($"Both {StringProperty} and {classToLog} as params", _logger.Collector.LatestRecord.Message);
313_logger.Collector.LatestRecord.StructuredState.Should().NotBeNull().And.Equal(expectedState);
321LogMethodNullablePropertyInClassMatchesNonNullable(_logger, classToLog);
322Assert.Equal(1, _logger.Collector.Count);
323Assert.Equal(LogLevel.Information, _logger.Collector.LatestRecord.Level);
324Assert.Equal($"Testing nullable property within class here...", _logger.Collector.LatestRecord.Message);
333_logger.Collector.LatestRecord.StructuredState.Should().NotBeNull().And.Equal(expectedState);
341LogMethodNullablePropertyInClassMatchesNonNullable(_logger, classToLog);
342Assert.Equal(1, _logger.Collector.Count);
343Assert.Equal(LogLevel.Information, _logger.Collector.LatestRecord.Level);
344Assert.Equal($"Testing nullable property within class here...", _logger.Collector.LatestRecord.Message);
352_logger.Collector.LatestRecord.StructuredState.Should().NotBeNull().And.Equal(expectedState);
361new NonStaticTestClass(_logger).LogProperties(StringParamValue, classToLog);
363Assert.Equal(1, _logger.Collector.Count);
364var latestRecord = _logger.Collector.LatestRecord;
385LogMethodStruct(_logger, structToLog);
387Assert.Equal(1, _logger.Collector.Count);
388var latestRecord = _logger.Collector.LatestRecord;
415LogMethodNullableStruct(_logger, in structToLog);
417Assert.Equal(1, _logger.Collector.Count);
418var latestRecord = _logger.Collector.LatestRecord;
443LogMethodExplicitNullableStruct(_logger, null);
445Assert.Equal(1, _logger.Collector.Count);
447var latestRecord = _logger.Collector.LatestRecord;
468LogMethodDefaultAttrCtor(_logger, LogLevel.Critical, classToLog);
470Assert.Equal(1, _logger.Collector.Count);
471var latestRecord = _logger.Collector.LatestRecord;
495LogMethodInterfaceArg(_logger, classToLog);
497Assert.Equal(1, _logger.Collector.Count);
498var latestRecord = _logger.Collector.LatestRecord;
519LogRecordClass(_logger, recordToLog);
521Assert.Equal(1, _logger.Collector.Count);
522var latestRecord = _logger.Collector.LatestRecord;
544LogRecordStruct(_logger, recordToLog);
546Assert.Equal(1, _logger.Collector.Count);
547var latestRecord = _logger.Collector.LatestRecord;
570LogReadonlyRecordStruct(_logger, recordToLog);
572Assert.Equal(1, _logger.Collector.Count);
573var latestRecord = _logger.Collector.LatestRecord;