Browse Source

Only show Expected/But Was for failing tests in AssertDriverContentsAre

tznind 2 years ago
parent
commit
6be225bb3d
1 changed files with 5 additions and 2 deletions
  1. 5 2
      UnitTests/TestHelpers.cs

+ 5 - 2
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);
 		}