コード例 #1
0
 public static void IfNotCastable <T>([CanBeNull][NoEnumeration] object value, Violation message)
 {
     Fail.IfNotCastable(value, typeof(T), message);
 }
コード例 #2
0
 public static void IfNullOrNotCastable <T>([CanBeNull][NoEnumeration] object value)
 {
     Fail.IfNull(value, Violation.WhenCannotCast <T>("object", value));
     Fail.IfNotCastable <T>(value, Violation.WhenCannotCast <T>("object", value));
 }
コード例 #3
0
 public static void IfNotCastable <T>([CanBeNull][NoEnumeration] object value, [NotNull] string message, [NotNull] params object[] args)
 {
     Fail.IfNotCastable(value, typeof(T), message, args);
 }
コード例 #4
0
        public static T AsOrFail <T>([CanBeNull][NoEnumeration] this object value, [CanBeNull] string name = null)
        {
            Fail.IfNotCastable <T>(value, Violation.WhenCannotCast <T>(name ?? "object", value));

            return((T)value);
        }
コード例 #5
0
 public static void IfNullOrNotCastable <T>([CanBeNull][NoEnumeration] object value)
 {
     Fail.IfNull(value, Fail.notCastableMessage, typeof(T), "<null>");
     Fail.IfNotCastable <T>(value, Fail.notCastableMessage, typeof(T), value);
 }
コード例 #6
0
        public static T AsOrFail <T>([CanBeNull][NoEnumeration] this object value, [CanBeNull] string name = null)
        {
            Fail.IfNotCastable <T>(value, Fail.notCastableMessageWithName, name ?? "object", typeof(T), value);

            return((T)value);
        }
コード例 #7
0
 public static void IfArgumentEmpty(Guid value, [NotNull] string argumentName)
 {
     Fail.RequiresArgumentName(argumentName);
     Fail.IfEmpty(value, Violation.WhenGuidArgumentIsEmpty(argumentName));
 }
コード例 #8
0
 // ReSharper disable once InconsistentNaming
 public static void fian([CanBeNull][NoEnumeration] this object argumentValue)
 {
     Fail.IfArgumentNull(argumentValue, nameof(argumentValue));
 }
コード例 #9
0
        public static void IfArgumentEmpty(Guid value, [NotNull][InvokerParameterName] string argumentName)
        {
            Fail.RequiresArgumentName(argumentName);

            Fail.IfEqual(Guid.Empty, value, "Argument '{0}' is an empty Guid.", argumentName);
        }
コード例 #10
0
 public static void IfEmpty(Guid value, Violation message)
 {
     Fail.IfEqual(Guid.Empty, value, message);
 }
コード例 #11
0
        public static void IfEmpty(Guid value, [NotNull] string message, [NotNull] params object[] args)
        {
            Fail.RequiresMessage(message, args);

            Fail.IfEqual(Guid.Empty, value, message, args);
        }
コード例 #12
0
 public static DesignByContractViolationException Because <T1>([NotNull][System.Diagnostics.CodeAnalysis.NotNull] string message, T1 arg1)
 {
     return(Fail.Because(message.Formatted(arg1)));
 }
コード例 #13
0
        public static DesignByContractViolationException Because([NotNull][System.Diagnostics.CodeAnalysis.NotNull] string message)
        {
            Fail.RequiresMessage(message);

            return(new DesignByContractViolationException(message));
        }
コード例 #14
0
 // ReSharper disable once InconsistentNaming
 public static void fiaw([CanBeNull] this string argumentValue)
 {
     Fail.IfArgumentWhiteSpace(argumentValue, nameof(argumentValue));
 }
コード例 #15
0
 // ReSharper disable once InconsistentNaming
 public static void fiae([CanBeNull] this string argumentValue)
 {
     Fail.IfArgumentEmpty(argumentValue, nameof(argumentValue));
 }