Skip to content

fix: include because-reason when verifying that an exception is thrown#657

Merged
vbreuss merged 1 commit intomainfrom
topic/fix-because-reason-when-throw
Jun 26, 2025
Merged

fix: include because-reason when verifying that an exception is thrown#657
vbreuss merged 1 commit intomainfrom
topic/fix-because-reason-when-throw

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Jun 26, 2025

When an "And" node (or an "Or" node) has an empty node, this node is ignored during evaluation, but the because reason is applied to it.
In this case, the because reason should instead be applied to the latest previous node.

@vbreuss vbreuss self-assigned this Jun 26, 2025
Copilot AI review requested due to automatic review settings June 26, 2025 15:44
@vbreuss vbreuss added the bug Something isn't working label Jun 26, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that exception verification tests include a clear "because" reason, refines the logic for setting the reason in expectation nodes, and adjusts the build pipeline configuration to target core-only builds.

  • Updates exception verification tests to include an explanatory reason.
  • Refactors the SetReason logic in OrNode and AndNode to handle empty expectation nodes.
  • Changes the BuildScope in the build pipeline from Default to CoreOnly.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Tests/aweXpect.Tests/Delegates/ThatDelegate.ThrowsException.Tests.cs Enhances exception verification tests with a "because" reason to improve clarity.
Source/aweXpect.Core/Core/Nodes/OrNode.cs Adapts SetReason to delegate to a child node if the current expectation node is empty.
Source/aweXpect.Core/Core/Nodes/AndNode.cs Adapts SetReason to delegate to a child node if the current expectation node is empty.
Pipeline/Build.cs Updates BuildScope configuration to build only core components.
Comments suppressed due to low confidence (1)

Pipeline/Build.cs:22

  • Update the accompanying documentation or comments to clarify the reasoning behind changing the BuildScope from Default to CoreOnly.
	readonly BuildScope BuildScope = BuildScope.CoreOnly;

Comment thread Source/aweXpect.Core/Core/Nodes/OrNode.cs
@vbreuss vbreuss enabled auto-merge (squash) June 26, 2025 15:46
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 26, 2025

@vbreuss vbreuss disabled auto-merge June 26, 2025 15:48
@vbreuss vbreuss merged commit 81ab219 into main Jun 26, 2025
11 checks passed
@vbreuss vbreuss deleted the topic/fix-because-reason-when-throw branch June 26, 2025 15:48
@github-actions
Copy link
Copy Markdown
Contributor

This is addressed in release v2.18.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Because not included when checking for a delegate to throw

2 participants