Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

IT-VBFK
Copy link
Contributor

@IT-VBFK IT-VBFK commented Sep 25, 2023

Until 6.12 you are not able to chain .ForConstraint() after .Then.

The only possibility for was to check .ForConstraint() first and then chain all subsequent assertions with .Then.

This leads to following issue: you cannot pre-check for e.g. null or empty, which leads to multiple sets of Execute.Assertions... to check every possible failure first.

This PR introduces this .ForConstraint() to the contract IAssertionScope to make this before mentioned possible.

Closes #1918

IMPORTANT

  • If the PR touches the public API, the changes have been approved in a separate issue with the "api-approved" label.
  • The code complies with the Coding Guidelines for C#.
  • The changes are covered by unit tests which follow the Arrange-Act-Assert syntax and the naming conventions such as is used in these tests.
  • If the PR adds a feature or fixes a bug, please update the release notes with a functional description that explains what the change means to consumers of this library, which are published on the website.
  • If the PR changes the public API the changes needs to be included by running AcceptApiChanges.ps1 or AcceptApiChanges.sh.
  • If the PR affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
    • Please also run ./build.sh --target spellcheck or .\build.ps1 --target spellcheck before pushing and check the good outcome

@coveralls
Copy link

coveralls commented Sep 25, 2023

Pull Request Test Coverage Report for Build 6330154472

  • 5 of 5 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 97.297%

Totals Coverage Status
Change from base Build 6329311286: 0.02%
Covered Lines: 11637
Relevant Lines: 11840

💛 - Coveralls

@github-actions
Copy link

github-actions bot commented Sep 25, 2023

Qodana for .NET

1 new problem were found

Inspection name Severity Problems
Use preferred body style (convert into property, indexer, or event with preferred body style) ◽️ Notice 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

  1. Register at Qodana Cloud and configure the action
  2. Use GitHub Code Scanning with Qodana
  3. Host Qodana report at GitHub Pages
  4. Inspect and use qodana.sarif.json (see the Qodana SARIF format for details)

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/[email protected]
        with:
          upload-result: true
Contact Qodana team

Contact us at [email protected]

@IT-VBFK IT-VBFK force-pushed the feature/add-for-constraint-to-iassertionsscope branch 3 times, most recently from 1a08ece to 0469474 Compare September 25, 2023 20:47
@IT-VBFK IT-VBFK marked this pull request as ready for review September 25, 2023 21:09
@IT-VBFK
Copy link
Contributor Author

IT-VBFK commented Sep 26, 2023

Maybe I an missing something, but I don't get how to construct a test to cover the last coverage issue.

Edit: nevermind... using var scope = new AssertionScope() does it 😊

@IT-VBFK IT-VBFK force-pushed the feature/add-for-constraint-to-iassertionsscope branch 5 times, most recently from e8d1c24 to 1d0dc8c Compare September 27, 2023 18:45
@IT-VBFK IT-VBFK force-pushed the feature/add-for-constraint-to-iassertionsscope branch from 1d0dc8c to 052d912 Compare September 28, 2023 19:59
@dennisdoomen dennisdoomen requested a review from jnyrup September 29, 2023 17:39
This was referenced Sep 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ForConstraint to IAssertionScope
4 participants