Skip to content
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

feat(unit-tests): increase code coverage #251

Merged
merged 3 commits into from
Sep 29, 2024

Conversation

dmitrii-kiselev
Copy link
Contributor

@dmitrii-kiselev dmitrii-kiselev commented Sep 29, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows Conventional Commits
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no API changes)
  • Other... Please describe:

What is the current behavior?

  • No pull request template
  • No unit tests for the DbCommandInterceptorProcessor class
  • No unit tests for the SecondLevelCacheInterceptor class
  • Unit tests are not run when creating a pull request or merging into the master

What is the new behavior?

  • Pull request template (this will ensure that pull requests are filled in detail when new people create them)
  • The DbCommandInterceptorProcessor class is covered by 100%
  • The SecondLevelCacheInterceptor class is covered by 98%
  • Unit tests are run when creating a pull request or merging into the master (this will give confidence that the changes do not break the existing logic)

Overall code coverage increased from 19% to 35%:

image

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This work improves the overall quality of the project.

Best Regards,
Dmitrii Kiselev

This commit adds:
- Pull request template
- Unit tests for `DbCommandInterceptorProcessor` class
- Unit tests for `SecondLevelCacheInterceptor` class
- The task is to run unit tests after the build
Copy link

what-the-diff bot commented Sep 29, 2024

PR Summary

  • Introduction of a Pull Request Template
    A template for new pull requests has been added. This model includes a checklist that guides the user during the submission process, helping assign the type of pull request and define the existing and new behavior, as well as clarifications on potential large scale changes. This simplification is intended to increase consistency and clarity across all submitted requests.

  • Enhancement of GitHub Actions Workflow
    In the workflow file responsible for building the repository, a new task has been included that enables automatic unit testing for the software library named EFCoreSecondLevelCacheInterceptor. This action not only runs the tests against the particular software section but also creates comprehensive log reports about the tests’ outcomes. This added system increases code reliability and visibility for developers inspecting the output.

_cacheSettings.SkipCachingDbContexts = new List<Type> { context.GetType() };

// Act
var actual = _processor.ProcessExecutedCommands(command, context, result);

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This assignment to
actual
is useless, since its value is never read.
// Assert
_cacheServiceMock.Verify(x => x.InsertValue(
efCacheKey,
It.Is<EFCachedData>(data => data.Scalar == result),

Check warning

Code scanning / CodeQL

Reference equality test on System.Object Warning

Reference equality for System.Object comparisons (
this
argument has type Object).
// Assert
_cacheServiceMock.Verify(x => x.InsertValue(
efCacheKey,
It.Is<EFCachedData>(data => data.Scalar == result),

Check warning

Code scanning / CodeQL

Reference equality test on System.Object Warning

Reference equality for System.Object comparisons (
this
argument has type Object).
This commit fixes a unit test that failed due to cultural differences.
@VahidN VahidN merged commit f08a7e2 into VahidN:master Sep 29, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants