diff --git a/test/Microsoft.NET.TestFramework/Assertions/CommandResultAssertions.cs b/test/Microsoft.NET.TestFramework/Assertions/CommandResultAssertions.cs index a7220a60eb89..211e6a881728 100644 --- a/test/Microsoft.NET.TestFramework/Assertions/CommandResultAssertions.cs +++ b/test/Microsoft.NET.TestFramework/Assertions/CommandResultAssertions.cs @@ -143,9 +143,9 @@ public AndConstraint HaveStdErrContainingOnce(string pa { var lines = _commandResult.StdErr?.Split(new[] { Environment.NewLine }, StringSplitOptions.None); var matchingLines = lines?.Where(line => line.Contains(pattern)).Count(); - Execute.Assertion.ForCondition(matchingLines == 0) + Execute.Assertion.ForCondition(matchingLines != 0) .FailWith(AppendDiagnosticsTo($"The command error output did not contain expected result: {pattern}{Environment.NewLine}")); - Execute.Assertion.ForCondition(matchingLines != 1) + Execute.Assertion.ForCondition(matchingLines == 1) .FailWith(AppendDiagnosticsTo($"The command error output was expected to contain the pattern '{pattern}' once, but found it {matchingLines} times.{Environment.NewLine}")); return new AndConstraint(this); } diff --git a/test/dotnet-run.Tests/GivenDotnetRunThrowsAParseError.cs b/test/dotnet-run.Tests/GivenDotnetRunThrowsAParseError.cs index f03f4c618427..cb31366e3de9 100644 --- a/test/dotnet-run.Tests/GivenDotnetRunThrowsAParseError.cs +++ b/test/dotnet-run.Tests/GivenDotnetRunThrowsAParseError.cs @@ -19,7 +19,7 @@ public void ItFailsWithAnAppropriateErrorMessage() .WithWorkingDirectory(Path.GetTempPath()) .Execute("--", "1") .Should().Fail() - .And.HaveStdErrContainingOnce(LocalizableStrings.RunCommandExceptionNoProjects); + .And.HaveStdErrContainingOnce("Couldn't find a project to run."); } } }