Exemplo n.º 1
0
 public static void NoneNull <T>(IEnumerable <T> coll, string message)
 {
     if (coll.Any(x => x is null))
     {
         ValueException.Throw(message);
     }
 }
Exemplo n.º 2
0
 public static void NotEmpty <T>(IEnumerable <T> coll, string message)
 {
     if (coll.None())
     {
         ValueException.Throw(message);
     }
 }
Exemplo n.º 3
0
 public static void Ensure(bool expression)
 {
     if (!expression)
     {
         ValueException.Throw("Expression does not equal true.");
     }
 }
Exemplo n.º 4
0
 public static void Ensure(bool expression, [NotNull] string message)
 {
     if (!expression)
     {
         ValueException.Throw(message);
     }
 }
Exemplo n.º 5
0
        public static void ValidSnowflake([CanBeNull] string snowflake, [NotNull] string message)
        {
            Require(snowflake, message);
            var nw = snowflake.Replace(" ", "");

            if (nw.Length > 20 || !nw.All(char.IsNumber))
            {
                ValueException.Throw($"{message} is not a valid snowflake string! Provided: \"{snowflake}\"");
            }
        }