diff --git a/Pipeline/Build.cs b/Pipeline/Build.cs index a07a0cc08..25356ef59 100644 --- a/Pipeline/Build.cs +++ b/Pipeline/Build.cs @@ -19,7 +19,7 @@ partial class Build : NukeBuild /// /// Afterward, you can update the package reference in `Directory.Packages.props` and reset this flag. /// - readonly BuildScope BuildScope = BuildScope.Default; + readonly BuildScope BuildScope = BuildScope.CoreOnly; [Parameter("Github Token")] readonly string GithubToken; diff --git a/Source/aweXpect.Core/Core/Nodes/AndNode.cs b/Source/aweXpect.Core/Core/Nodes/AndNode.cs index 6502e9db2..1b69b5414 100644 --- a/Source/aweXpect.Core/Core/Nodes/AndNode.cs +++ b/Source/aweXpect.Core/Core/Nodes/AndNode.cs @@ -79,7 +79,16 @@ public override async Task IsMetBy(TValue? value, /// public override void SetReason(BecauseReason becauseReason) - => Current.SetReason(becauseReason); + { + if (_nodes.Any() && Current is ExpectationNode expectationNode && expectationNode.IsEmpty()) + { + _nodes.Last().Item2.SetReason(becauseReason); + } + else + { + Current.SetReason(becauseReason); + } + } /// public override void AppendExpectation(StringBuilder stringBuilder, string? indentation = null) diff --git a/Source/aweXpect.Core/Core/Nodes/OrNode.cs b/Source/aweXpect.Core/Core/Nodes/OrNode.cs index 612933a64..5889e985b 100644 --- a/Source/aweXpect.Core/Core/Nodes/OrNode.cs +++ b/Source/aweXpect.Core/Core/Nodes/OrNode.cs @@ -73,7 +73,16 @@ public override async Task IsMetBy(TValue? value, /// public override void SetReason(BecauseReason becauseReason) - => Current.SetReason(becauseReason); + { + if (_nodes.Any() && Current is ExpectationNode expectationNode && expectationNode.IsEmpty()) + { + _nodes.Last().Item2.SetReason(becauseReason); + } + else + { + Current.SetReason(becauseReason); + } + } /// public override void AppendExpectation(StringBuilder stringBuilder, string? indentation = null) diff --git a/Tests/aweXpect.Tests/Delegates/ThatDelegate.ThrowsException.Tests.cs b/Tests/aweXpect.Tests/Delegates/ThatDelegate.ThrowsException.Tests.cs index d773abde0..6573b1ae5 100644 --- a/Tests/aweXpect.Tests/Delegates/ThatDelegate.ThrowsException.Tests.cs +++ b/Tests/aweXpect.Tests/Delegates/ThatDelegate.ThrowsException.Tests.cs @@ -51,12 +51,12 @@ public async Task WhenNoExceptionIsThrown_ShouldFail() Action action = () => { }; async Task Act() - => await That(action).ThrowsException(); + => await That(action).ThrowsException().Because("it should throw"); await That(Act).ThrowsException() .WithMessage(""" Expected that action - throws an exception, + throws an exception, because it should throw, but it did not throw any exception """); }