Ejemplo n.º 1
0
 public static ContinuationOfGiven <IEnumerable <T> > AssertEitherCollectionIsNotEmpty <T>(
     this GivenSelector <IEnumerable <T> > givenSelector, int length)
 {
     return(givenSelector
            .ForCondition(items => !EitherIsEmpty(length, items.Count()))
            .FailWith("but found empty collection."));
 }
Ejemplo n.º 2
0
 public static ContinuationOfGiven <IEnumerable <T> > AssertCollectionIsNotNull <T>(
     this GivenSelector <IEnumerable <T> > givenSelector)
 {
     return(givenSelector
            .ForCondition(items => !ReferenceEquals(items, null))
            .FailWith("but found collection is <null>."));
 }
 public static ContinuationOfGiven <ICollection <T> > AssertCollectionHasNotTooManyItems <T>(this GivenSelector <ICollection <T> > givenSelector,
                                                                                             int length)
 {
     return(givenSelector
            .ForCondition(items => items.Count <= length)
            .FailWith("but {0} contains {1} item(s) too many.", items => items, items => items.Count - length));
 }
 public static ContinuationOfGiven <ICollection <T> > AssertEitherCollectionIsNotEmpty <T>(
     this GivenSelector <ICollection <T> > givenSelector, int length)
 {
     return(givenSelector
            .ForCondition(items => ((items.Count > 0) || (length == 0)))
            .FailWith("but found empty collection.")
            .Then
            .ForCondition(items => ((items.Count == 0) || (length > 0)))
            .FailWith("but found {0}.", items => items));
 }
 public static ContinuationOfGiven <ICollection <T> > AssertCollectionHasEnoughItems <T>(this GivenSelector <ICollection <T> > givenSelector, int length)
 {
     return(givenSelector
            .ForCondition(items => items.Count >= length)
            .FailWith("but {0} contains {1} item(s) less.", items => items, items => length - items.Count));
 }