/// <summary> /// Asserts that the given collection is ordered ascending with the /// provided comparer for T. A collection with less than 2 items will /// always fail. /// </summary> /// <param name="collectionOrdered">Continuation</param> /// <param name="comparer">Comparer for two items of type T, /// implementing IComparer<T></param> /// <typeparam name="T">Collection item type</typeparam> /// <returns></returns> public static IMore <IEnumerable <T> > Ascending <T>( this ICollectionOrdered <T> collectionOrdered, IComparer <T> comparer ) { return(collectionOrdered.Ascending(comparer, NULL_STRING)); }
/// <summary> /// Asserts that the given collection is ordered ascending with the /// default comparer for T. A collection with less than 2 items will /// always fail. /// </summary> /// <param name="collectionOrdered">Continuation</param> /// <typeparam name="T">Collection item type</typeparam> /// <returns></returns> public static IMore <IEnumerable <T> > Ascending <T>( this ICollectionOrdered <T> collectionOrdered ) { return(collectionOrdered.Ascending( Comparer <T> .Default )); }
/// <summary> /// Asserts that the given collection is ordered ascending with the /// default comparer for T. A collection with less than 2 items will /// always fail. /// </summary> /// <param name="collectionOrdered">Continuation</param> /// <param name="customMessage">Custom message to include when assertion fails</param> /// <typeparam name="T">Collection item type</typeparam> /// <returns></returns> public static IMore <IEnumerable <T> > Ascending <T>( this ICollectionOrdered <T> collectionOrdered, string customMessage) { return(collectionOrdered.Ascending( Comparer <T> .Default, customMessage )); }
/// <summary> /// Asserts that the given collection is ordered descending with the /// default comparer for T. A collection with less than 2 items will /// always fail. /// </summary> /// <param name="collectionOrdered">Continuation</param> /// <param name="customMessageGenerator"> /// Generates a custom message to include when assertion fails</param> /// <typeparam name="T">Collection item type</typeparam> /// <returns></returns> public static IMore <IEnumerable <T> > Descending <T>( this ICollectionOrdered <T> collectionOrdered, Func <string> customMessageGenerator ) { return(collectionOrdered.Descending( Comparer <T> .Default, customMessageGenerator )); }
/// <summary> /// Asserts that the given collection is ordered descending with the /// provided comparer for T. A collection with less than 2 items will /// always fail. /// </summary> /// <param name="collectionOrdered">Continuation</param> /// <param name="comparer">Comparer for two items of type T, /// implementing IComparer<T></param> /// <param name="customMessage">Custom message to include when assertion fails</param> /// <typeparam name="T">Collection item type</typeparam> /// <returns></returns> public static IMore <IEnumerable <T> > Descending <T>( this ICollectionOrdered <T> collectionOrdered, IComparer <T> comparer, string customMessage ) { return(collectionOrdered.Descending( comparer, () => customMessage )); }
/// <summary> /// Asserts that the given collection is ordered descending with the /// provided comparer for T. A collection with less than 2 items will /// always fail. /// </summary> /// <param name="collectionOrdered">Continuation</param> /// <param name="comparer">Comparer for two items of type T, /// implementing IComparer<T></param> /// <param name="customMessageGenerator"> /// Generates a custom message to include when assertion fails</param> /// <typeparam name="T">Collection item type</typeparam> /// <returns></returns> public static IMore <IEnumerable <T> > Descending <T>( this ICollectionOrdered <T> collectionOrdered, IComparer <T> comparer, Func <string> customMessageGenerator ) { return(collectionOrdered.AddMatcher( actual => { return TestOrderingOf( actual, comparer, i => i < 0, customMessageGenerator ); })); }