Skip to content

Commit da7e651

Browse files
committed
Missing XML Docs
1 parent 4d1059a commit da7e651

11 files changed

Lines changed: 101 additions & 1 deletion

src/MELT.AspNetCore/MELTWebApplicationFactoryExtensions.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@
55

66
namespace Microsoft.AspNetCore.Mvc.Testing
77
{
8+
/// <summary>
9+
/// Extension methods for <see cref="WebApplicationFactory{TStartup}"/> to work with test logging capabilities.
10+
/// </summary>
811
public static class MELTWebApplicationFactoryExtensions
912
{
13+
/// <summary>
14+
/// Tries to get the <see cref="ITestSink"/> which is capturing the logs for the given <see cref="WebApplicationFactory{TStartup}"/>.
15+
/// </summary>
16+
/// <typeparam name="TStartup">The type of the startup class.</typeparam>
17+
/// <param name="factory">The <see cref="WebApplicationFactory{TStartup}"/> used in the current test.</param>
18+
/// <param name="testSink">The <see cref="ITestSink"/> which is capturing logs, if configured.</param>
19+
/// <returns>True if the <see cref="WebApplicationFactory{TStartup}"/> has been configured to use the test logger.</returns>
1020
[Obsolete("The recommended alternative is " + nameof(TryGetTestLoggerSink) + "(out " + nameof(ITestLoggerSink) + ")")]
1121
public static bool TryGetTestSink<TStartup>(this WebApplicationFactory<TStartup> factory, out ITestSink? testSink)
1222
where TStartup : class
@@ -21,6 +31,12 @@ public static bool TryGetTestSink<TStartup>(this WebApplicationFactory<TStartup>
2131
return false;
2232
}
2333

34+
/// <summary>
35+
/// Gets the <see cref="ITestSink"/> which is capturing the logs for the given <see cref="WebApplicationFactory{TStartup}"/>.
36+
/// </summary>
37+
/// <typeparam name="TStartup">The type of the startup class.</typeparam>
38+
/// <param name="factory">The <see cref="WebApplicationFactory{TStartup}"/> used in the current test.</param>
39+
/// <returns>The <see cref="ITestSink"/> which is capturing logs.</returns>
2440
[Obsolete("The recommended alternative is " + nameof(GetTestLoggerSink) + "()")]
2541
public static ITestSink GetTestSink<TStartup>(this WebApplicationFactory<TStartup> factory)
2642
where TStartup : class

src/MELT.AspNetCore/MELTWebHostBuilderExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace Microsoft.AspNetCore.Hosting
66
{
7+
/// <summary>
8+
/// Extension methods for <see cref="IWebHostBuilder"/> to add test logging capabilities.
9+
/// </summary>
710
public static class MELTWebHostBuilderExtensions
811
{
912
/// <summary>

src/MELT.Serilog.AspNetCore/MELTSerilogWebHostBuilderExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace Microsoft.AspNetCore.Hosting
66
{
7+
/// <summary>
8+
/// Extension methods for <see cref="IWebHostBuilder"/> to add Serilog test logging capabilities.
9+
/// </summary>
710
public static class MELTSerilogWebHostBuilderExtensions
811
{
912
/// <summary>

src/MELT.Serilog/ISerilogTestLoggerSink.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22

33
namespace MELT
44
{
5+
/// <summary>
6+
/// Represents a test logger sink for capturing Serilog log entries during testing.
7+
/// </summary>
58
public interface ISerilogTestLoggerSink
69
{
10+
/// <summary>
11+
/// Gets the collection of captured Serilog log entries.
12+
/// </summary>
713
IEnumerable<SerilogLogEntry> LogEntries { get; }
814

15+
/// <summary>
16+
/// Clears all captured log entries.
17+
/// </summary>
918
void Clear();
1019
}
1120
}

src/MELT.Serilog/SerilogLogEntry.cs

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,62 @@
77

88
namespace MELT
99
{
10+
/// <summary>
11+
/// Represents a log entry captured from Serilog during testing.
12+
/// </summary>
1013
public class SerilogLogEntry
1114
{
15+
#pragma warning disable CS0612 // Type or member is obsolete
1216
private readonly WriteContext _writeContext;
17+
#pragma warning restore CS0612 // Type or member is obsolete
1318
private static readonly IReadOnlyList<LogEventPropertyValue> _emptyProperties = new LogEventPropertyValue[0];
1419
private string? _format;
1520
private IReadOnlyList<LogEventPropertyValue>? _scope;
1621

22+
/// <summary>
23+
/// Initializes a new instance of the <see cref="SerilogLogEntry"/> class.
24+
/// </summary>
25+
/// <param name="writeContext">The write context containing log information.</param>
26+
[Obsolete]
1727
public SerilogLogEntry(WriteContext writeContext)
1828
{
1929
_writeContext = writeContext;
2030
}
2131

32+
/// <summary>
33+
/// Gets the event ID for this log entry.
34+
/// </summary>
2235
public EventId EventId => _writeContext.EventId;
36+
37+
/// <summary>
38+
/// Gets the exception associated with this log entry, if any.
39+
/// </summary>
2340
public Exception? Exception => _writeContext.Exception;
41+
42+
/// <summary>
43+
/// Gets the name of the logger that created this log entry.
44+
/// </summary>
2445
public string LoggerName => _writeContext.LoggerName;
46+
47+
/// <summary>
48+
/// Gets the log level of this log entry.
49+
/// </summary>
2550
public LogLevel LogLevel => _writeContext.LogLevel;
51+
52+
/// <summary>
53+
/// Gets the formatted log message.
54+
/// </summary>
2655
public string? Message => _writeContext.Message;
56+
57+
/// <summary>
58+
/// Gets the properties associated with this log entry.
59+
/// </summary>
2760
public IReadOnlyList<KeyValuePair<string, object>> Properties => _writeContext.State as IReadOnlyList<KeyValuePair<string, object>> ?? Constants.EmptyProperties;
2861

62+
/// <summary>
63+
/// Gets the original format of the log message before parameter substitution.
64+
/// </summary>
2965
public string OriginalFormat => _format ??= GetFormat();
30-
3166
private string GetFormat()
3267
{
3368
foreach (var prop in Properties)
@@ -45,9 +80,18 @@ private string GetFormat()
4580
return Constants.NullString;
4681
}
4782

83+
/// <summary>
84+
/// Gets the scope values from Serilog log entry.
85+
/// </summary>
86+
/// <remarks>
87+
/// This property is obsolete. Use <see cref="Scopes"/> instead.
88+
/// </remarks>
4889
[Obsolete("The recommended alternative is " + nameof(Scopes) + ".")]
4990
public IReadOnlyList<LogEventPropertyValue> Scope => _scope ??= GetSerilogScopes();
5091

92+
/// <summary>
93+
/// Gets the scope values from Serilog log entry.
94+
/// </summary>
5195
public IReadOnlyList<LogEventPropertyValue> Scopes => _scope ??= GetSerilogScopes();
5296

5397
private IReadOnlyList<LogEventPropertyValue> GetSerilogScopes()

src/MELT.Serilog/SerilogScope.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
namespace MELT
22
{
3+
/// <summary>
4+
/// Represents a Serilog-specific logging scope for use in tests.
5+
/// </summary>
36
public class SerilogScope : Scope
47
{
8+
/// <summary>
9+
/// Initializes a new instance of the <see cref="SerilogScope"/> class.
10+
/// </summary>
11+
/// <param name="scope">The scope object to capture.</param>
512
public SerilogScope(object? scope) : base(scope)
613
{
714
}

src/MELT.Serilog/SerilogTestLoggerSinkAccessor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace MELT
55
{
6+
#pragma warning disable CS0612 // Type or member is obsolete
67
internal class SerilogTestLoggerSinkAccessor : ISerilogTestLoggerSink
78
{
89
private readonly IInternalTestSink _sink;

src/MELT.Xunit/LogValuesAssert.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
namespace MELT.Xunit
99
{
10+
/// <summary>
11+
/// Provides assertion methods for verifying logging values.
12+
/// </summary>
1013
[Obsolete("The recommended alternative is Xunit." + nameof(LoggingAssert) + ".")]
1114
public static class LogValuesAssert
1215
{

src/MELT.Xunit/LoggingAssert.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
namespace Xunit
1111
{
12+
/// <summary>
13+
/// Provides assertion methods for verifying logging-related behaviors.
14+
/// </summary>
1215
public static class LoggingAssert
1316
{
1417
/// <summary>

src/MELT/Helpers/MELTLoggerFactoryExtensions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@
33

44
namespace Microsoft.Extensions.Logging
55
{
6+
/// <summary>
7+
/// Extension methods for <see cref="ILoggerFactory"/> to work with test logging capabilities.
8+
/// </summary>
69
public static class MELTLoggerFactoryExtensions
710
{
11+
/// <summary>
12+
/// Gets the test logger sink from the logger factory.
13+
/// </summary>
14+
/// <param name="loggerFactory">The logger factory to get the sink from.</param>
15+
/// <returns>The <see cref="ITestLoggerSink"/> instance associated with the factory.</returns>
16+
/// <exception cref="ArgumentException">Thrown when the logger factory is not created with <see cref="TestLoggerFactory"/>.</exception>
817
public static ITestLoggerSink GetTestLoggerSink(this ILoggerFactory loggerFactory)
918
{
1019
if (loggerFactory is TestLoggerFactory testLoggerFactory) return testLoggerFactory.Sink;

0 commit comments

Comments
 (0)