Ejemplo n.º 1
0
 public static AssertObject <T, TNew> Have <T, TProperty, TNew>(this AssertScope <T, TProperty> assertScope, Expression <Func <T, TNew> > expression)
 {
     return(new AssertObject <T, TNew>(On(
                                           assertScope.Subject,
                                           expression,
                                           assertScope.VariableName)));
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
 public static void HasNoItem <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x == 0, "HasNoItem");
 }
Ejemplo n.º 4
0
 public static void IsZero <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x == 0, "IsZero");
 }
Ejemplo n.º 5
0
 public static void MoreThanZero <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x > 0, "MoreThanZero");
 }
Ejemplo n.º 6
0
 public static void IsFalse <T>(this AssertScope <T, bool> a)
 {
     a.AreEqual(false);
 }
Ejemplo n.º 7
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);
 }
Ejemplo n.º 8
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");
 }
Ejemplo n.º 9
0
 public static void IsTrue <T>(this AssertScope <T, bool> a)
 {
     a.AreEqual(true);
 }
Ejemplo n.º 10
0
 public static void IsNotNullOrWhiteSpace <T>(this AssertScope <T, string> helper)
 {
     helper.IsTrue(
         x => !string.IsNullOrWhiteSpace(x),
         "Is not null or white space");
 }
Ejemplo n.º 11
0
 public static void IsNotNull <T, TTarget>(this AssertScope <T, TTarget> helper) where TTarget : class
 {
     helper.IsTrue(x => x != null, "Is not null");
 }
Ejemplo n.º 12
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));
 }
Ejemplo n.º 13
0
 public AssertObject(AssertScope <T, TProperty> scope)
 {
     Scope = scope;
 }