-
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.
Use the .NET Standard 2.0 instead of .NET Core. (#3)
- Loading branch information
1 parent
7cfa05a
commit 69d35df
Showing
6 changed files
with
108 additions
and
51 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
28 changes: 28 additions & 0 deletions
28
src/Logging.Assertions/LoggerMockSetupSequenceErrorExtensions.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,28 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="LoggerMockSetupSequenceErrorExtensions.cs" company="P.O.S Informatique"> | ||
// Copyright (c) P.O.S Informatique. All rights reserved. | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
namespace PosInformatique.Logging.Assertions | ||
{ | ||
using FluentAssertions; | ||
using Microsoft.Extensions.Logging; | ||
|
||
/// <summary> | ||
/// Extensions method of the <see cref="ILoggerMockSetupSequenceError"/> interface to setup the <see cref="LogLevel.Error"/> log level. | ||
/// </summary> | ||
public static class LoggerMockSetupSequenceErrorExtensions | ||
{ | ||
/// <summary> | ||
/// Allows to check the <see cref="Exception"/> passed in the argument of the <see cref="ILogger.Log{TState}(LogLevel, EventId, TState, Exception?, Func{TState, Exception?, string})"/>. | ||
/// </summary> | ||
/// <param name="sequence"><see cref="ILoggerMockSetupSequence"/> to setup the sequence.</param> | ||
/// <param name="expectedException"><see cref="Exception"/> instance expected.</param> | ||
/// <returns>An instance of <see cref="ILoggerMockSetupSequence"/> which allows to continue the setup of the method calls.</returns> | ||
public static ILoggerMockSetupSequence WithException(this ILoggerMockSetupSequenceError sequence, Exception expectedException) | ||
{ | ||
return sequence.WithException(actualException => actualException.Should().BeSameAs(expectedException)); | ||
} | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
src/Logging.Assertions/LoggerMockSetupSequenceExtensions.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,64 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="LoggerMockSetupSequenceExtensions.cs" company="P.O.S Informatique"> | ||
// Copyright (c) P.O.S Informatique. All rights reserved. | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
namespace PosInformatique.Logging.Assertions | ||
{ | ||
using Microsoft.Extensions.Logging; | ||
|
||
/// <summary> | ||
/// Extensions method of the <see cref="ILoggerMockSetupSequence"/> interface to setup the sequence of the expected logs. | ||
/// </summary> | ||
public static class LoggerMockSetupSequenceExtensions | ||
{ | ||
/// <summary> | ||
/// Expect the call to the <see cref="ILogger.Log{TState}(LogLevel, EventId, TState, Exception?, Func{TState, Exception?, string})"/> method | ||
/// with a <see cref="LogLevel.Debug"/> log level. | ||
/// </summary> | ||
/// <param name="sequence"><see cref="ILoggerMockSetupSequence"/> to setup the sequence.</param> | ||
/// <param name="message">Message of the <see cref="ILogger.Log{TState}(LogLevel, EventId, TState, Exception?, Func{TState, Exception?, string})"/> call expected.</param> | ||
/// <returns>The current <paramref name="sequence"/> which allows to continue the setup of the <see cref="ILogger"/> method calls.</returns> | ||
public static ILoggerMockSetupSequence LogDebug(this ILoggerMockSetupSequence sequence, string message) | ||
{ | ||
return sequence.Log(LogLevel.Debug, message); | ||
} | ||
|
||
/// <summary> | ||
/// Expect the call to the <see cref="ILogger.Log{TState}(LogLevel, EventId, TState, Exception?, Func{TState, Exception?, string})"/> method | ||
/// with a <see cref="LogLevel.Information"/> log level. | ||
/// </summary> | ||
/// <param name="sequence"><see cref="ILoggerMockSetupSequence"/> to setup the sequence.</param> | ||
/// <param name="message">Message of the <see cref="ILogger.Log{TState}(LogLevel, EventId, TState, Exception?, Func{TState, Exception?, string})"/> call expected.</param> | ||
/// <returns>The current <paramref name="sequence"/> which allows to continue the setup of the <see cref="ILogger"/> method calls.</returns> | ||
public static ILoggerMockSetupSequence LogInformation(this ILoggerMockSetupSequence sequence, string message) | ||
{ | ||
return sequence.Log(LogLevel.Information, message); | ||
} | ||
|
||
/// <summary> | ||
/// Expect the call to the <see cref="ILogger.Log{TState}(LogLevel, EventId, TState, Exception?, Func{TState, Exception?, string})"/> method | ||
/// with a <see cref="LogLevel.Trace"/> log level. | ||
/// </summary> | ||
/// <param name="sequence"><see cref="ILoggerMockSetupSequence"/> to setup the sequence.</param> | ||
/// <param name="message">Message of the <see cref="ILogger.Log{TState}(LogLevel, EventId, TState, Exception?, Func{TState, Exception?, string})"/> call expected.</param> | ||
/// <returns>The current <paramref name="sequence"/> which allows to continue the setup of the <see cref="ILogger"/> method calls.</returns> | ||
public static ILoggerMockSetupSequence LogTrace(this ILoggerMockSetupSequence sequence, string message) | ||
{ | ||
return sequence.Log(LogLevel.Trace, message); | ||
} | ||
|
||
/// <summary> | ||
/// Expect the call to the <see cref="ILogger.Log{TState}(LogLevel, EventId, TState, Exception?, Func{TState, Exception?, string})"/> method | ||
/// with a <see cref="LogLevel.Warning"/> log level. | ||
/// </summary> | ||
/// <param name="sequence"><see cref="ILoggerMockSetupSequence"/> to setup the sequence.</param> | ||
/// <param name="message">Message of the <see cref="ILogger.Log{TState}(LogLevel, EventId, TState, Exception?, Func{TState, Exception?, string})"/> call expected.</param> | ||
/// <returns>The current <paramref name="sequence"/> which allows to continue the setup of the <see cref="ILogger"/> method calls.</returns> | ||
public static ILoggerMockSetupSequence LogWarning(this ILoggerMockSetupSequence sequence, string message) | ||
{ | ||
return sequence.Log(LogLevel.Warning, 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