From 6be225bb3d27698eada8a2c8515526d4608a5707 Mon Sep 17 00:00:00 2001 From: tznind Date: Wed, 1 Feb 2023 01:22:47 +0000 Subject: [PATCH] Only show Expected/But Was for failing tests in AssertDriverContentsAre --- UnitTests/TestHelpers.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/UnitTests/TestHelpers.cs b/UnitTests/TestHelpers.cs index b76da0a35..44fd374e4 100644 --- a/UnitTests/TestHelpers.cs +++ b/UnitTests/TestHelpers.cs @@ -120,8 +120,11 @@ class TestHelpers { expectedLook = expectedLook.Replace ("\r\n", "\n"); actualLook = actualLook.Replace ("\r\n", "\n"); - output?.WriteLine ("Expected:" + Environment.NewLine + expectedLook); - output?.WriteLine ("But Was:" + Environment.NewLine + actualLook); + // If test is about to fail show user what things looked like + if(!string.Equals(expectedLook,actualLook)) { + output?.WriteLine ("Expected:" + Environment.NewLine + expectedLook); + output?.WriteLine ("But Was:" + Environment.NewLine + actualLook); + } Assert.Equal (expectedLook, actualLook); }