public static void Require(bool mustBeTrue, string message)
        {
            InternalContract.RequireNotNullOrWhiteSpace(message, nameof(message));
            var m = GetErrorMessageIfFalse(mustBeTrue, message);

            MaybeThrowException(m);
        }
Exemplo n.º 2
0
        public static void MatchesNotRegExp(string regularExpression, string propertyValue, string propertyName, string errorLocation, string customMessage = null)
        {
            InternalContract.RequireNotNullOrWhiteSpace(regularExpression, nameof(regularExpression));
            var message = customMessage ?? $"Expected property {propertyName} ({propertyValue}) to not match ({regularExpression}).";

            GenericAssert <ValidationException> .MatchesNotRegExp(regularExpression, propertyValue, errorLocation, message);
        }
Exemplo n.º 3
0
 public static void IsTrue(bool mustBeTrue, string errorLocation, string message)
 {
     InternalContract.RequireNotNullOrWhiteSpace(message, nameof(message));
     GenericAssert <ValidationException> .IsTrue(mustBeTrue, errorLocation, message);
 }
 public static void Fail(string message)
 {
     InternalContract.RequireNotNullOrWhiteSpace(message, nameof(message));
     GenericBase <TException> .ThrowException(message);
 }
 private static string GetErrorMessageIfFalse(bool mustBeTrue, string message)
 {
     InternalContract.RequireNotNullOrWhiteSpace(message, nameof(message));
     return(mustBeTrue ? null : message);
 }
 public static void Require(bool mustBeTrue, string message)
 {
     InternalContract.RequireNotNullOrWhiteSpace(message, nameof(message));
     GenericContract <FulcrumServiceContractException> .Require(mustBeTrue, message);
 }
Exemplo n.º 7
0
 public static void Fail(string message)
 {
     InternalContract.RequireNotNullOrWhiteSpace(message, nameof(message));
     GenericAssert <FulcrumAssertionFailedException> .Fail(null, message);
 }
Exemplo n.º 8
0
 public static void MatchesNotRegExp(string regularExpression, string value, string errorLocation = null, string customMessage = null)
 {
     InternalContract.RequireNotNullOrWhiteSpace(regularExpression, nameof(regularExpression));
     GenericAssert <FulcrumAssertionFailedException> .MatchesNotRegExp(regularExpression, value, errorLocation, customMessage);
 }