From c31eb7e601b13743862e6f918690551344d6b7ca Mon Sep 17 00:00:00 2001 From: Jason Nelson Date: Fri, 31 Aug 2018 10:10:07 -0700 Subject: [PATCH] [SL.Core] Use Assert.Contains when checking for substrings --- tests/SixLabors.Core.Tests/Helpers/DebugGuardTests.cs | 4 ++-- tests/SixLabors.Core.Tests/Helpers/GuardTests.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/SixLabors.Core.Tests/Helpers/DebugGuardTests.cs b/tests/SixLabors.Core.Tests/Helpers/DebugGuardTests.cs index f3db76ef54..68416b47dc 100644 --- a/tests/SixLabors.Core.Tests/Helpers/DebugGuardTests.cs +++ b/tests/SixLabors.Core.Tests/Helpers/DebugGuardTests.cs @@ -99,7 +99,7 @@ namespace SixLabors.Helpers.Tests }); Assert.Equal("myParamName", exception.ParamName); - Assert.True(exception.Message.Contains($"Value must be greater than {min}.")); + Assert.Contains($"Value must be greater than {min}.", exception.Message); } [Theory] @@ -119,7 +119,7 @@ namespace SixLabors.Helpers.Tests }); Assert.Equal("myParamName", exception.ParamName); - Assert.True(exception.Message.Contains($"Value must be greater than or equal to 2.")); + Assert.Contains($"Value must be greater than or equal to 2.", exception.Message); } [Theory] diff --git a/tests/SixLabors.Core.Tests/Helpers/GuardTests.cs b/tests/SixLabors.Core.Tests/Helpers/GuardTests.cs index f95e46e355..ecffd79daa 100644 --- a/tests/SixLabors.Core.Tests/Helpers/GuardTests.cs +++ b/tests/SixLabors.Core.Tests/Helpers/GuardTests.cs @@ -65,7 +65,7 @@ namespace SixLabors.Helpers.Tests }); Assert.Equal("myParamName", exception.ParamName); - Assert.True(exception.Message.Contains($"Value must be greater than {min}.")); + Assert.Contains($"Value must be greater than {min}.", exception.Message); } [Theory] @@ -108,7 +108,7 @@ namespace SixLabors.Helpers.Tests }); Assert.Equal("myParamName", exception.ParamName); - Assert.True(exception.Message.Contains($"Value must be greater than or equal to {min} and less than or equal to {max}.")); + Assert.Contains($"Value must be greater than or equal to {min} and less than or equal to {max}.", exception.Message); } [Theory] @@ -128,7 +128,7 @@ namespace SixLabors.Helpers.Tests }); Assert.Equal("myParamName", exception.ParamName); - Assert.True(exception.Message.Contains($"The size must be at least 3.")); + Assert.Contains("The size must be at least 3.", exception.Message); } } }