From 929007d9a40f0069326fb48349908827b689363a Mon Sep 17 00:00:00 2001 From: Jason Nelson Date: Fri, 24 Aug 2018 11:53:44 -0700 Subject: [PATCH] [SL.Core] Remove unused Gaurd.IsTrue and Gaurd.IsFalse --- src/SixLabors.Core/Helpers/Guard.cs | 42 ------------------- .../Helpers/GuardTests.cs | 36 ---------------- 2 files changed, 78 deletions(-) diff --git a/src/SixLabors.Core/Helpers/Guard.cs b/src/SixLabors.Core/Helpers/Guard.cs index 069c4eb051..0e4ef336d4 100644 --- a/src/SixLabors.Core/Helpers/Guard.cs +++ b/src/SixLabors.Core/Helpers/Guard.cs @@ -169,48 +169,6 @@ namespace SixLabors } } - /// - /// Verifies, that the method parameter with specified target value is true - /// and throws an exception if it is found to be so. - /// - /// - /// The target value, which cannot be false. - /// - /// - /// The name of the parameter that is to be checked. - /// - /// - /// The error message, if any to add to the exception. - /// - /// - /// is false - /// - public static void IsTrue(bool value, string parameterName, string message) - { - if (!value) - { - throw new ArgumentException(message, parameterName); - } - } - - /// - /// Verifies, that the method parameter with specified target value is false - /// and throws an exception if it is found to be so. - /// - /// The target value, which cannot be true. - /// The name of the parameter that is to be checked. - /// The error message, if any to add to the exception. - /// - /// is true - /// - public static void IsFalse(bool value, string parameterName, string message) - { - if (value) - { - throw new ArgumentException(message, parameterName); - } - } - /// /// Verifies, that the `target` span has the length of 'minLength', or longer. /// diff --git a/tests/SixLabors.Core.Tests/Helpers/GuardTests.cs b/tests/SixLabors.Core.Tests/Helpers/GuardTests.cs index b3f1b96a0e..fee12db175 100644 --- a/tests/SixLabors.Core.Tests/Helpers/GuardTests.cs +++ b/tests/SixLabors.Core.Tests/Helpers/GuardTests.cs @@ -190,42 +190,6 @@ namespace SixLabors.Helpers.Tests Assert.True(exception.Message.Contains($"Value must be greater than or equal to {min} and less than or equal to {max}.")); } - [Fact] - public void IsTrue_IsTrue_ThrowsNoException() - { - Guard.IsTrue(true, "myParamName", "myTestMessage"); - } - - [Fact] - public void IsTrue_IsFalse_ThrowsException() - { - var exception = Assert.Throws(() => - { - Guard.IsTrue(false, "myParamName", "myTestMessage"); - }); - - Assert.Equal("myParamName", exception.ParamName); - Assert.True(exception.Message.Contains("myTestMessage")); - } - - [Fact] - public void IsFalse_IsFalse_ThrowsNoException() - { - Guard.IsFalse(false, "myParamName", "myTestMessage"); - } - - [Fact] - public void IsFalse_IsTrue_ThrowsException() - { - var exception = Assert.Throws(() => - { - Guard.IsFalse(true, "myParamName", "myTestMessage"); - }); - - Assert.Equal("myParamName", exception.ParamName); - Assert.True(exception.Message.Contains("myTestMessage")); - } - [Theory] [InlineData(2, 1)] [InlineData(2, 2)]