Ejemplo n.º 1
0
        /// <summary>
        /// Checks if the sut contains the same element than a given list.
        /// </summary>
        /// <param name="context">Context for the check</param>
        /// <param name="expectedValues"> expected content</param>
        /// <typeparam name="T">Type of enumerable content</typeparam>
        /// <returns>A chainable link.</returns>
        public static ICheckLink <ICheck <IEnumerable <T> > > IsEquivalentTo <T>(this ICheck <IEnumerable <T> > context,
                                                                                 params T[] expectedValues)
        {
            var checker = ExtensibilityHelper.BeginCheck(context);

            EqualityHelper.ImplementEquivalentTo(checker, ExtractEnumerableValueFromPossibleOneValueArray(expectedValues));
            return(ExtensibilityHelper.BuildCheckLink(context));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Checks that the actual <see cref="IDictionary{K,V}"/> is equivalent to a given dictionary.
        /// </summary>
        /// <param name="check">The fluent check to be extended.</param>
        /// <param name="other">Reference dictionary</param>
        /// <typeparam name="TK">Type for keys.</typeparam>
        /// <typeparam name="TU">Type for values.</typeparam>
        /// <returns>A check link.</returns>
        public static ICheckLink <ICheck <IEnumerable <KeyValuePair <TK, TU> > > > IsEquivalentTo <TK, TU>(
            this ICheck <IEnumerable <KeyValuePair <TK, TU> > > check, IEnumerable <KeyValuePair <TK, TU> > other)
        {
            var checker = ExtensibilityHelper.BeginCheck(check);

            EqualityHelper.ImplementEquivalentTo(checker, other);
            return(ExtensibilityHelper.BuildCheckLink(check));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Checks if the sut contains the same element than a given list.
        /// </summary>
        /// <param name="context">Context for the check</param>
        /// <param name="expectedValues">Expected values</param>
        /// <returns>A chainable link.</returns>
        public static ICheckLink <ICheck <IEnumerable> > IsEquivalentTo(this ICheck <IEnumerable> context,
                                                                        params object[] expectedValues)
        {
            var checker    = ExtensibilityHelper.BeginCheck(context);
            var dictionary = ExtractDictionaryFromValueArray(expectedValues);

            if (dictionary != null)
            {
                EqualityHelper.ImplementEquivalentTo(checker, dictionary);
            }
            else
            {
                EqualityHelper.ImplementEquivalentTo(checker, ExtractEnumerableValueFromPossibleOneValueArray(expectedValues));
            }
            return(ExtensibilityHelper.BuildCheckLink(context));
        }