Esempio n. 1
0
        /// <summary>
        /// Checks that the actual value doesn't have all fields equal to the expected value ones.
        /// </summary>
        /// <typeparam name="T">
        /// Type of the checked value.
        /// </typeparam>
        /// <param name="check">
        /// The fluent check to be extended.
        /// </param>
        /// <param name="expected">
        /// The expected value.
        /// </param>
        /// <returns>
        /// A check link.
        /// </returns>
        /// <exception cref="FluentCheckException">
        /// The actual value has all fields equal to the expected value ones.
        /// </exception>
        /// <remarks>
        /// The comparison is done field by field.
        /// </remarks>
        public static ICheckLink <ICheck <T> > HasNotFieldsWithSameValues <T>(this ICheck <T> check, object expected)
        {
            IChecker <T, ICheck <T> > checker = ExtensibilityHelper.ExtractChecker(check);
            bool negated = !checker.Negated;

            string message = CheckFieldEquality(checker, checker.Value, expected, negated);

            if (message != null)
            {
                throw new FluentCheckException(message);
            }

            return(checker.BuildChainingObject());
        }