예제 #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)));
 }
예제 #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);
 }
예제 #3
0
 public static void HasNoItem <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x == 0, "HasNoItem");
 }
예제 #4
0
 public static void IsZero <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x == 0, "IsZero");
 }
예제 #5
0
 public static void MoreThanZero <T>(this AssertScope <T, int> a)
 {
     a.IsTrue(x => x > 0, "MoreThanZero");
 }
예제 #6
0
 public static void IsFalse <T>(this AssertScope <T, bool> a)
 {
     a.AreEqual(false);
 }
예제 #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);
 }
예제 #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");
 }
예제 #9
0
 public static void IsTrue <T>(this AssertScope <T, bool> a)
 {
     a.AreEqual(true);
 }
예제 #10
0
 public static void IsNotNullOrWhiteSpace <T>(this AssertScope <T, string> helper)
 {
     helper.IsTrue(
         x => !string.IsNullOrWhiteSpace(x),
         "Is not null or white space");
 }
예제 #11
0
 public static void IsNotNull <T, TTarget>(this AssertScope <T, TTarget> helper) where TTarget : class
 {
     helper.IsTrue(x => x != null, "Is not null");
 }
예제 #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));
 }
예제 #13
0
 public AssertObject(AssertScope <T, TProperty> scope)
 {
     Scope = scope;
 }