generated from dailydevops/dotnet-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
138,620 additions
and
905 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
tests/NetEvolve.Logging.XUnit.Tests.Integration/TestCase.cs
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
tests/NetEvolve.Logging.XUnit.Tests.Integration/TestCase1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
namespace NetEvolve.Logging.XUnit.Tests.Integration; | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Extensions.Logging; | ||
|
||
internal sealed partial class TestCase1 | ||
{ | ||
private readonly ILogger _logger; | ||
|
||
public TestCase1(ILogger logger) => _logger = logger; | ||
|
||
public TestCase1(ILogger<TestCase1> logger) => _logger = logger; | ||
|
||
public void Run() | ||
{ | ||
using var scope1 = _logger.BeginScope("Scope"); | ||
#pragma warning disable CA1848 // Use the LoggerMessage delegates | ||
using var scope2 = _logger.BeginScope("Execution {Now}", DateTimeOffset.Now); | ||
using var scope3 = _logger.BeginScope( | ||
new Dictionary<string, object> { { "ExectionTime", DateTimeOffset.Now } } | ||
); | ||
#pragma warning restore CA1848 // Use the LoggerMessage delegates | ||
LogTrace(); | ||
LogDebug(); | ||
LogInformation(); | ||
LogWarning(); | ||
LogError(); | ||
LogCritical(); | ||
} | ||
|
||
[LoggerMessage(0, LogLevel.Trace, "Trace")] | ||
private partial void LogTrace(); | ||
|
||
[LoggerMessage(1, LogLevel.Debug, "Debug")] | ||
private partial void LogDebug(); | ||
|
||
[LoggerMessage(2, LogLevel.Information, "Information")] | ||
private partial void LogInformation(); | ||
|
||
[LoggerMessage(3, LogLevel.Warning, "Warning")] | ||
private partial void LogWarning(); | ||
|
||
[LoggerMessage(4, LogLevel.Error, "Error")] | ||
private partial void LogError(); | ||
|
||
[LoggerMessage(5, LogLevel.Critical, "Critical")] | ||
private partial void LogCritical(); | ||
} |
33 changes: 33 additions & 0 deletions
33
tests/NetEvolve.Logging.XUnit.Tests.Integration/TestCase2.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
namespace NetEvolve.Logging.XUnit.Tests.Integration; | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Extensions.Logging; | ||
|
||
internal sealed partial class TestCase2 | ||
{ | ||
private readonly ILogger _logger; | ||
|
||
public TestCase2(ILogger logger) => _logger = logger; | ||
|
||
public TestCase2(ILogger<TestCase2> logger) => _logger = logger; | ||
|
||
public void Run() | ||
{ | ||
LogBefore(1, null); | ||
try | ||
{ | ||
throw new InvalidOperationException(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
LogException(ex, "Unknown exception."); | ||
} | ||
} | ||
|
||
[LoggerMessage(0, LogLevel.Information, "Before {Number}: {Name}")] | ||
private partial void LogBefore(int number, string? name); | ||
|
||
[LoggerMessage(1, LogLevel.Error, "Exception: {Message}")] | ||
private partial void LogException(Exception ex, string message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.