示例#1
0
 public static void HasPredicatedItem <T, TItem, TCollection>(
     this AssertScope <T, TCollection> a,
     Expression <Func <TItem, bool> > predicate)
     where TCollection : class, IEnumerable <TItem>
 {
     a.IsTrue(x => x != null && x.Any(predicate.Compile()), "HasPredicatedItem " + predicate);
 }
示例#2
0
 public static void HasNoItem <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x == 0, "HasNoItem");
 }
示例#3
0
 public static void IsZero <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x == 0, "IsZero");
 }
示例#4
0
 public static void MoreThanZero <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x > 0, "MoreThanZero");
 }
示例#5
0
 public static void Contains <T, TItem, TCollection>(this AssertScope <T, TCollection> a, TItem item)
     where TCollection : class, IEnumerable <TItem>
 {
     a.IsTrue(x => x != null && x.Contains(item), "Contains " + item);
 }
示例#6
0
 public static void HasAnyItem <T, TCollection>(this AssertScope <T, TCollection> a)
     where TCollection : class, IEnumerable
 {
     a.IsTrue(x => x != null && x.OfType <object>().Any(), "HasAnyItem");
 }
示例#7
0
 public static void IsNotNullOrWhiteSpace <T>(this AssertScope <T, string> helper)
 {
     helper.IsTrue(
         x => !string.IsNullOrWhiteSpace(x),
         "Is not null or white space");
 }
示例#8
0
 public static void IsNotNull <T, TTarget>(this AssertScope <T, TTarget> helper) where TTarget : class
 {
     helper.IsTrue(x => x != null, "Is not null");
 }
示例#9
0
 public static void IsBetween <T>(this AssertScope <T, decimal> a, decimal minValue, decimal maxValue)
 {
     a.IsTrue(x => x > 0, string.Format("Between({0},{1})", minValue, maxValue));
 }