Update the fluent assertions version to improve test failure output. Include a failing tests to verify.

This commit is contained in:
Marc Paine 2023-12-14 16:55:39 -08:00
parent 461c776642
commit d9d1e85d54
3 changed files with 5 additions and 5 deletions

View file

@ -82,7 +82,7 @@ namespace EndToEnd.Tests
var runCommand = new RunCommand() var runCommand = new RunCommand()
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput() .ExecuteWithCapturedOutput()
.Should().Pass().And.HaveStdOutContaining("Hello, World!"); .Should().Pass().And.HaveStdOutContaining("Hello, World!ds");
} }
[WindowsOnlyTheory] [WindowsOnlyTheory]

View file

@ -42,7 +42,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
public AndConstraint<CommandResultAssertions> HaveStdOut() public AndConstraint<CommandResultAssertions> HaveStdOut()
{ {
Execute.Assertion.ForCondition(!string.IsNullOrEmpty(_commandResult.StdOut)) Execute.Assertion.ForCondition(!string.IsNullOrEmpty(_commandResult.StdOut))
.FailWith(AppendDiagnosticsTo("Command did not output anything to stdout")); .FailWith(AppendDiagnosticsTo($"Command did not output anything to stdout"));
return new AndConstraint<CommandResultAssertions>(this); return new AndConstraint<CommandResultAssertions>(this);
} }
@ -97,7 +97,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
public AndConstraint<CommandResultAssertions> HaveStdErr() public AndConstraint<CommandResultAssertions> HaveStdErr()
{ {
Execute.Assertion.ForCondition(!string.IsNullOrEmpty(_commandResult.StdErr)) Execute.Assertion.ForCondition(!string.IsNullOrEmpty(_commandResult.StdErr))
.FailWith(AppendDiagnosticsTo("Command did not output anything to stderr.")); .FailWith(AppendDiagnosticsTo($"Command did not output anything to stderr."));
return new AndConstraint<CommandResultAssertions>(this); return new AndConstraint<CommandResultAssertions>(this);
} }
@ -132,7 +132,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
public AndConstraint<CommandResultAssertions> NotHaveStdErr() public AndConstraint<CommandResultAssertions> NotHaveStdErr()
{ {
Execute.Assertion.ForCondition(string.IsNullOrEmpty(_commandResult.StdErr)) Execute.Assertion.ForCondition(string.IsNullOrEmpty(_commandResult.StdErr))
.FailWith(AppendDiagnosticsTo("Expected command to not output to stderr but it was not:")); .FailWith(AppendDiagnosticsTo($"Expected command to not output to stderr but it was not:"));
return new AndConstraint<CommandResultAssertions>(this); return new AndConstraint<CommandResultAssertions>(this);
} }

View file

@ -5,7 +5,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="FluentAssertions" Version="4.18.0" /> <PackageReference Include="FluentAssertions" Version="6.12.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>