/// <summary> /// Verify that <paramref name="mustBeTrue"/> is true. /// </summary> /// <param name="mustBeTrue">The value that must be true.</param> /// <param name="message">A message that documents/explains this failure. This message should normally start with "Expected ...".</param> /// <param name="errorLocation">A unique errorLocation for the part of errorLocation where the validation didn't hold.</param> public static void IsTrue(bool mustBeTrue, string errorLocation, string message) { InternalContract.RequireNotNull(errorLocation, nameof(errorLocation)); InternalContract.RequireNotNullOrWhitespace(message, nameof(message)); GenericAssert <FulcrumAssertionFailedException> .IsTrue(mustBeTrue, errorLocation, message); }
/// <summary> /// Verify that <paramref name="actualValue"/> is equal to <paramref name="expectedValue"/>. /// </summary> public static void AreEqual(object expectedValue, object actualValue, string errorLocation, string customMessage = null) { InternalContract.RequireNotNull(errorLocation, nameof(errorLocation)); GenericAssert <FulcrumAssertionFailedException> .AreEqual(expectedValue, actualValue, errorLocation, customMessage); }
/// <summary> /// Will always fail. Used in parts of the errorLocation where we should never end up. E.g. a default case in a switch statement where all cases should be covered, so we should never end up in the default case. /// </summary> /// <param name="errorLocation">A unique errorLocation for the part of errorLocation where the validation didn't hold.</param> /// <param name="message">A message that documents/explains this failure. This message should normally start with "Expected ...".</param> public static void Fail(string errorLocation, string message) { InternalContract.RequireNotNull(message, nameof(message)); InternalContract.RequireNotNull(errorLocation, nameof(errorLocation)); GenericAssert <FulcrumAssertionFailedException> .Fail(errorLocation, message); }
/// <summary> /// Verify that <paramref name="value"/> is not null, not empty and contains other characters than white space. /// </summary> public static void IsNotNullOrWhiteSpace(string value, string errorLocation, string customMessage = null) { InternalContract.RequireNotNull(errorLocation, nameof(errorLocation)); GenericAssert <FulcrumAssertionFailedException> .IsNotNullOrWhiteSpace(value, errorLocation, customMessage); }