-
Notifications
You must be signed in to change notification settings - Fork 4
test(refactor): improve code coverage #635
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
Merged
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
4a5750d
test: Add comprehensive tests for DiagnosticEditProperties methods
rjmurillo 55867eb
test: Add unit tests for DiagnosticExtensions methods
rjmurillo df1886c
test: Add unit test for CreateDiagnostic_FromOperation_WithProperties…
rjmurillo e51072f
test: Add unit tests for MoqVerificationHelpers methods
rjmurillo da87546
test: Add unit test for NoFixForExplicitInterfaceImplementation method
rjmurillo ca2f3bc
docs: Update C# file instructions to enforce valid code in tests
rjmurillo 0bc2ba6
docs: Update C# file instructions to include code coverage validation…
rjmurillo 63d39b6
test: Update test data for RedundantTimesSpecificationAnalyzer to inc…
rjmurillo 774d2b2
docs: Update CONTRIBUTING.md to include code coverage validation requ…
rjmurillo a89a5d2
refactor: Remove unused using directives in MoqVerificationHelpersTests
rjmurillo 368dffc
test: Remove redundant entry from test data in RedundantTimesSpecific…
rjmurillo 2e85b52
test: Add additional cases for ExtractLambdaFromArgument in MoqVerifi…
rjmurillo 59bf028
test: Enhance InvalidTestData with detailed comments and add verifica…
rjmurillo 2067433
test: Add edge case tests for LinqToMocks expressions and refine exis…
rjmurillo bc5e21f
refactor: Simplify TestData method by using array initializers and im…
rjmurillo 50267de
test: Enhance TestData method with additional edge cases and improve …
rjmurillo 30c9fce
test: Remove unnecessary test case for property access in TestData me…
rjmurillo 7a2df5c
test: Update CodeCoverage settings to exclude additional attributes a…
rjmurillo af00375
test: Add coverage history management to CI workflow and update cover…
rjmurillo e928265
test: Add baseline SHA to performance results summary
rjmurillo 48662fd
test: Add comprehensive tests for DiagnosticEditProperties methods
rjmurillo 26347b2
test: Add unit tests for DiagnosticExtensions methods
rjmurillo c284cc5
test: Add unit test for CreateDiagnostic_FromOperation_WithProperties…
rjmurillo 351b6c3
test: Add unit tests for MoqVerificationHelpers methods
rjmurillo a260489
test: Add unit test for NoFixForExplicitInterfaceImplementation method
rjmurillo 3114a71
docs: Update C# file instructions to enforce valid code in tests
rjmurillo 656e0b4
docs: Update C# file instructions to include code coverage validation…
rjmurillo ca0aa8b
test: Update test data for RedundantTimesSpecificationAnalyzer to inc…
rjmurillo afebfd9
docs: Update CONTRIBUTING.md to include code coverage validation requ…
rjmurillo 50024c5
refactor: Remove unused using directives in MoqVerificationHelpersTests
rjmurillo b7fb7a9
test: Remove redundant entry from test data in RedundantTimesSpecific…
rjmurillo ea9b2f5
test: Add additional cases for ExtractLambdaFromArgument in MoqVerifi…
rjmurillo b474f53
test: Enhance InvalidTestData with detailed comments and add verifica…
rjmurillo 43024eb
test: Add edge case tests for LinqToMocks expressions and refine exis…
rjmurillo 8059df2
refactor: Simplify TestData method by using array initializers and im…
rjmurillo 87937b2
test: Enhance TestData method with additional edge cases and improve …
rjmurillo 8f321e0
test: Remove unnecessary test case for property access in TestData me…
rjmurillo 93bc5a2
test: Update CodeCoverage settings to exclude additional attributes a…
rjmurillo 3a543bc
test: Add coverage history management to CI workflow and update cover…
rjmurillo 39c3999
test: Add baseline SHA to performance results summary
rjmurillo cabb69e
Merge branch 'refactor/coverage-analysis' of https://github.com/rjmur…
rjmurillo 00049eb
test: Remove upload step for coverage history in CI workflow
rjmurillo ada8199
fix: Update condition for uploading coverage history in CI workflow
rjmurillo 5632bf2
test: Enhance edge case test data for LinqToMocksExpressionShouldBeVa…
rjmurillo 9dccdc1
refactor: Remove redundant comment in LinqToMocksExpressionShouldBeVa…
rjmurillo 930c720
refactor: Remove TryGetFromImmutableDictionary_ParsesCultureInvariant…
rjmurillo 072a688
refactor: Remove unused using directives from analyzer and test files
rjmurillo 56775f4
Merge branch 'main' into refactor/coverage-analysis
rjmurillo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| using Microsoft.CodeAnalysis.Operations; | ||
| using Moq.Analyzers.Common; | ||
|
|
||
| namespace Moq.Analyzers; | ||
|
|
||
|
|
||
This file contains hidden or 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
1 change: 0 additions & 1 deletion
1
src/Analyzers/VerifyShouldBeUsedOnlyForOverridableMembersAnalyzer.cs
This file contains hidden or 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 |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using Microsoft.CodeAnalysis.Operations; | ||
|
|
||
| namespace Moq.Analyzers; | ||
|
|
||
This file contains hidden or 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 hidden or 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
58 changes: 58 additions & 0 deletions
58
tests/Moq.Analyzers.Test/Common/DiagnosticExtensionsTests.cs
This file contains hidden or 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,58 @@ | ||
| namespace Moq.Analyzers.Test.Common; | ||
|
Check warning on line 1 in tests/Moq.Analyzers.Test/Common/DiagnosticExtensionsTests.cs
|
||
|
|
||
| public class DiagnosticExtensionsTests | ||
| { | ||
| [Fact] | ||
| public void CreateDiagnostic_FromSyntaxNode_Basic() | ||
| { | ||
| SyntaxTree tree = CSharpSyntaxTree.ParseText("class C { void M() {} }"); | ||
| SyntaxNode root = tree.GetRoot(); | ||
| DiagnosticDescriptor rule = new DiagnosticDescriptor("TEST0001", "Test", "Test message", "Test", DiagnosticSeverity.Warning, true); | ||
| Diagnostic diag = root.CreateDiagnostic(rule); | ||
| Assert.Equal("TEST0001", diag.Id); | ||
| Assert.Equal(DiagnosticSeverity.Warning, diag.Severity); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void CreateDiagnostic_FromLocation_WithProperties() | ||
| { | ||
| SyntaxTree tree = CSharpSyntaxTree.ParseText("class C { void M() {} }"); | ||
| Location loc = tree.GetRoot().GetLocation(); | ||
| DiagnosticDescriptor rule = new DiagnosticDescriptor("TEST0002", "Test2", "Test message 2", "Test", DiagnosticSeverity.Info, true); | ||
| ImmutableDictionary<string, string?> properties = ImmutableDictionary<string, string?>.Empty.Add("Key", "Value"); | ||
| Diagnostic diag = loc.CreateDiagnostic(rule, properties); | ||
| Assert.Equal("TEST0002", diag.Id); | ||
| Assert.Equal("Value", diag.Properties["Key"]); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void CreateDiagnostic_FromOperation_DelegatesToSyntax() | ||
| { | ||
| SyntaxTree tree = CSharpSyntaxTree.ParseText("class C { void M() {} }"); | ||
| SyntaxNode root = tree.GetRoot(); | ||
| CSharpCompilation compilation = CSharpCompilation.Create("Test", new[] { tree }); | ||
| SemanticModel model = compilation.GetSemanticModel(tree); | ||
| MethodDeclarationSyntax methodDecl = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(); | ||
|
rjmurillo marked this conversation as resolved.
|
||
| Microsoft.CodeAnalysis.IOperation? operation = model.GetOperation(methodDecl); | ||
| DiagnosticDescriptor rule = new DiagnosticDescriptor("TEST0003", "Test3", "Test message 3", "Test", DiagnosticSeverity.Error, true); | ||
| Diagnostic diag = operation!.CreateDiagnostic(rule); | ||
| Assert.Equal("TEST0003", diag.Id); | ||
| Assert.Equal(DiagnosticSeverity.Error, diag.Severity); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void CreateDiagnostic_FromOperation_WithProperties() | ||
| { | ||
| SyntaxTree tree = CSharpSyntaxTree.ParseText("class C { void M() {} }"); | ||
| SyntaxNode root = tree.GetRoot(); | ||
| CSharpCompilation compilation = CSharpCompilation.Create("Test", new[] { tree }); | ||
| SemanticModel model = compilation.GetSemanticModel(tree); | ||
| MethodDeclarationSyntax methodDecl = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(); | ||
| Microsoft.CodeAnalysis.IOperation? operation = model.GetOperation(methodDecl); | ||
| DiagnosticDescriptor rule = new DiagnosticDescriptor("TEST0004", "Test4", "Test message 4", "Test", DiagnosticSeverity.Warning, true); | ||
| ImmutableDictionary<string, string?> properties = ImmutableDictionary<string, string?>.Empty.Add("Key2", "Value2"); | ||
| Diagnostic diag = operation!.CreateDiagnostic(rule, properties); | ||
| Assert.Equal("TEST0004", diag.Id); | ||
| Assert.Equal("Value2", diag.Properties["Key2"]); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.