-
Notifications
You must be signed in to change notification settings - Fork 0
Add test project and improve logging error handling #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| <Solution> | ||
| <Folder Name="/Solution Items/"> | ||
| <File Path=".github/workflows/dotnet-desktop.yml" /> | ||
| <File Path="README.md" /> | ||
| </Folder> | ||
| <Project Path="FluentLoggerExtensions.csproj" /> | ||
| <Project Path="src/FluentLoggerExtensions.csproj" /> | ||
| <Project Path="tests/FluentLoggerExtensions.Tests/FluentLoggerExtensions.Tests.csproj" Id="2c496e42-1236-4580-a854-98ce3e6cce11" /> | ||
| </Solution> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,73 @@ | ||||||
| using FluentLogger; | ||||||
| using Microsoft.Extensions.Logging; | ||||||
| using Moq; | ||||||
|
|
||||||
| namespace FluentLoggerExtensions.Tests; | ||||||
|
|
||||||
| public class CallerLogContextLogDebugTests | ||||||
| { | ||||||
| [Theory] | ||||||
| [InlineData("This is a test log message")] | ||||||
| [InlineData("This is another test log message")] | ||||||
| [InlineData("This is a really log test message")] | ||||||
| public void LogDebug_WithPlainMessage_DoesNotThrow(string message) | ||||||
| { | ||||||
| Mock<ILogger> logger = new(); | ||||||
| logger.Object.WithCaller().LogDebug(message); | ||||||
| logger.VerifyLogContains(message, LogLevel.Debug); | ||||||
| } | ||||||
|
|
||||||
| [Theory] | ||||||
| [InlineData("hello")] | ||||||
| public void LogDebug_WithInterpolatedString_DoesNotThrow(string id) | ||||||
| { | ||||||
| Mock<ILogger> logger = new(); | ||||||
|
|
||||||
| logger.Object.WithCaller().LogDebug($"{id}"); | ||||||
| } | ||||||
|
|
||||||
| [Theory] | ||||||
| [InlineData("hello", "there")] | ||||||
| public void LogDebug_WithMatchingPlaceholdersAndArguments_DoesNotThrow(string id, string id2) | ||||||
| { | ||||||
| Mock<ILogger> logger = new(); | ||||||
| logger.Object.WithCaller().LogDebug("{FirstWord} {SecondWord}", id, id2); | ||||||
| } | ||||||
|
|
||||||
| [Theory] | ||||||
| [InlineData("hello")] | ||||||
| public void LogDebug_WithMissingArguments_DoesNotThrowUntilStateIsEnumerated(string id) | ||||||
| { | ||||||
| Mock<ILogger> logger = new(); | ||||||
| logger.Object.WithCaller().LogDebug("{FirstWord} {SecondWord}", id); | ||||||
| } | ||||||
|
|
||||||
| [Fact] | ||||||
| public void Mismatched_placeholders_throw_when_state_is_enumerated() | ||||||
|
||||||
| public void Mismatched_placeholders_throw_when_state_is_enumerated() | |
| public void MismatchedPlaceholders_ThrowWhenStateIsEnumerated() |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,73 @@ | ||||||
| using FluentLogger; | ||||||
| using Microsoft.Extensions.Logging; | ||||||
| using Moq; | ||||||
|
|
||||||
| namespace FluentLoggerExtensions.Tests; | ||||||
|
|
||||||
| public class CallerLogContextLogErrorTests | ||||||
| { | ||||||
| [Theory] | ||||||
| [InlineData("This is a test log message")] | ||||||
| [InlineData("This is another test log message")] | ||||||
| [InlineData("This is a really log test message")] | ||||||
|
||||||
| [InlineData("This is a really log test message")] | |
| [InlineData("This is a really long test message")] |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test method name uses snake_case naming convention ("Mismatched_placeholders_throw_when_state_is_enumerated"), which is inconsistent with the PascalCase naming used in other test methods in this file (e.g., "LogError_WithPlainMessage_DoesNotThrow"). Consider renaming to "MismatchedPlaceholders_ThrowWhenStateIsEnumerated" for consistency.
| public void Mismatched_placeholders_throw_when_state_is_enumerated() | |
| public void MismatchedPlaceholders_ThrowWhenStateIsEnumerated() |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,73 @@ | ||||||
| using FluentLogger; | ||||||
| using Microsoft.Extensions.Logging; | ||||||
| using Moq; | ||||||
|
|
||||||
| namespace FluentLoggerExtensions.Tests; | ||||||
|
|
||||||
| public class CallerLogContextLogInformationTests | ||||||
| { | ||||||
| [Theory] | ||||||
| [InlineData("This is a test log message")] | ||||||
| [InlineData("This is another test log message")] | ||||||
| [InlineData("This is a really log test message")] | ||||||
|
||||||
| [InlineData("This is a really log test message")] | |
| [InlineData("This is a really long test message")] |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test method name uses snake_case naming convention ("Mismatched_placeholders_throw_when_state_is_enumerated"), which is inconsistent with the PascalCase naming used in other test methods in this file (e.g., "LogInformation_WithPlainMessage_DoesNotThrow"). Consider renaming to "MismatchedPlaceholders_ThrowWhenStateIsEnumerated" for consistency.
| public void Mismatched_placeholders_throw_when_state_is_enumerated() | |
| public void MismatchedPlaceholders_ThrowWhenStateIsEnumerated() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test description "This is a really log test message" contains a grammatical error. It should be "This is a really long test message" (with "long" instead of "log").