Exemplo n.º 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);
 }
Exemplo n.º 2
0
 public static void HasNoItem <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x == 0, "HasNoItem");
 }
Exemplo n.º 3
0
 public static void IsZero <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x == 0, "IsZero");
 }
Exemplo n.º 4
0
 public static void MoreThanZero <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x > 0, "MoreThanZero");
 }
Exemplo n.º 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);
 }
Exemplo n.º 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");
 }
Exemplo n.º 7
0
 public static void IsNotNullOrWhiteSpace <T>(this AssertScope <T, string> helper)
 {
     helper.IsTrue(
         x => !string.IsNullOrWhiteSpace(x),
         "Is not null or white space");
 }
Exemplo n.º 8
0
 public static void IsNotNull <T, TTarget>(this AssertScope <T, TTarget> helper) where TTarget : class
 {
     helper.IsTrue(x => x != null, "Is not null");
 }
Exemplo n.º 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));
 }