/// <summary>
        /// Checks that the actual value is not equal to another expected value.
        /// </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 is equal to the expected value.</exception>
        public static ICheckLink <ICheck <T> > IsNotEqualTo <T>(this ICheck <T> check, object expected)
        {
            var checker = ExtensibilityHelper.ExtractChecker(check);

            return(checker.ExecuteCheck(
                       () => EqualityHelper.IsNotEqualTo(checker, expected),
                       EqualityHelper.BuildErrorMessage(checker, expected, false)));
        }
Beispiel #2
0
        /// <summary>
        /// Checks that the actual value is equal to another expected value.
        /// </summary>
        /// <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 is not equal to the expected value.
        /// </exception>
        public static ICheckLink <ICheck <long> > IsEqualTo(this ICheck <long> check, long expected)
        {
            var checker = ExtensibilityHelper.ExtractChecker <long>(check);

            return(checker.ExecuteCheck(
                       () => EqualityHelper.IsEqualTo(checker, expected),
                       EqualityHelper.BuildErrorMessage(checker, expected, true)));
        }
Beispiel #3
0
        /// <summary>
        /// Checks that the actual value is not equal to another expected value.
        /// </summary>
        /// <typeparam name="T">Type of the struct or the enum to assert on.</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 is equal to the expected value.</exception>
        public static ICheckLink <IStructCheck <T> > IsNotEqualTo <T>(this IStructCheck <T> check, object expected) where T : struct
        {
            var runnableStructCheck = ExtensibilityHelper.ExtractStructChecker(check);

            return(runnableStructCheck.ExecuteCheck(
                       () => EqualityHelper.IsNotEqualTo(runnableStructCheck, expected),
                       EqualityHelper.BuildErrorMessage(runnableStructCheck, expected, false)));
        }
Beispiel #4
0
        /// <summary>
        /// Checks that the actual value is equal to another expected value.
        /// </summary>
        /// <typeparam name="T">Type of the struct or the enum to assert on.</typeparam>
        /// <param name="check">The fluent fluent check.</param>
        /// <param name="expected">The expected value.</param>
        /// <returns>
        /// A check link.
        /// </returns>
        /// <exception cref="FluentCheckException">The actual value is not equal to the expected value.</exception>
        public static ICheckLink <IStructCheck <T> > IsEqualTo <T>(this IStructCheck <T> check, T expected) where T : struct
        {
            var runnableStructCheck = ExtensibilityHelper.ExtractStructChecker(check);

            return(runnableStructCheck.ExecuteCheck(
                       () =>
            {
                EqualityHelper.IsEqualTo(runnableStructCheck.Value, expected);
            },
                       EqualityHelper.BuildErrorMessage(runnableStructCheck.Value, expected, true)));
        }
Beispiel #5
0
        /// <summary>
        /// Checks that the actual value is not equal to another expected value.
        /// </summary>
        /// <typeparam name="T">Type of the struct or the enum to assert on.</typeparam>
        /// <param name="fluentAssertion">The fluent assertion to be extended.</param>
        /// <param name="expected">The expected value.</param>
        /// <returns>
        /// A chainable assertion.
        /// </returns>
        /// <exception cref="FluentAssertionException">The actual value is equal to the expected value.</exception>
        public static IChainableFluentAssertion <IStructFluentAssertion <T> > IsNotEqualTo <T>(this IStructFluentAssertion <T> fluentAssertion, object expected) where T : struct
        {
            var assertionRunner   = fluentAssertion as IStructFluentAssertionRunner <T>;
            var runnableAssertion = fluentAssertion as IRunnableAssertion <T>;

            return(assertionRunner.ExecuteAssertion(
                       () =>
            {
                EqualityHelper.IsNotEqualTo(runnableAssertion.Value, expected);
            },
                       EqualityHelper.BuildErrorMessage(runnableAssertion.Value, expected, false)));
        }
Beispiel #6
0
        /// <summary>
        /// Checks that the actual value is not equal to another expected value.
        /// </summary>
        /// <returns>A chainable assertion.</returns>
        /// <param name="expected">The expected value.</param>
        /// <exception cref="FluentAssertionException">The actual value is equal to the expected value.</exception>
        public IChainableFluentAssertion <IFluentAssertion <N> > IsNotEqualTo(object expected)
        {
            var assertionRunner = this.fluentAssertion as IFluentAssertionRunner <N>;
            IRunnableAssertion <N> runnableAssertion = this;

            return(assertionRunner.ExecuteAssertion(
                       () =>
            {
                EqualityHelper.IsNotEqualTo(runnableAssertion.Value, expected);
            },
                       EqualityHelper.BuildErrorMessage(runnableAssertion.Value, expected, false)));
        }
Beispiel #7
0
        // TODO: add IsNull()

        /// <summary>
        /// Checks that the actual value is equal to another expected value.
        /// </summary>
        /// <param name="fluentAssertion">The fluent assertion to be extended.</param>
        /// <param name="expected">The expected value.</param>
        /// <returns>
        /// A chainable assertion.
        /// </returns>
        /// <exception cref="FluentAssertionException">The actual value is not equal to the expected value.</exception>
        public static IChainableFluentAssertion <IFluentAssertion <object> > IsEqualTo(this IFluentAssertion <object> fluentAssertion, object expected)
        {
            var assertionRunner   = fluentAssertion as IFluentAssertionRunner <object>;
            var runnableAssertion = fluentAssertion as IRunnableAssertion <object>;

            return(assertionRunner.ExecuteAssertion(
                       () =>
            {
                EqualityHelper.IsEqualTo(runnableAssertion.Value, expected);
            },
                       EqualityHelper.BuildErrorMessage(runnableAssertion.Value, expected, true)));
        }
Beispiel #8
0
        /// <summary>
        /// Checks that the actual value is not equal to another expected value.
        /// </summary>
        /// <param name="fluentAssertion">The fluent assertion to be extended.</param>
        /// <param name="expected">The expected value.</param>
        /// <returns>
        /// A chainable assertion.
        /// </returns>
        /// <exception cref="FluentAssertionException">The actual value is equal to the expected value.</exception>
        public static IChainableFluentAssertion <IFluentAssertion <IEnumerable> > IsNotEqualTo(this IFluentAssertion <IEnumerable> fluentAssertion, object expected)
        {
            var assertionRunner   = fluentAssertion as IFluentAssertionRunner <IEnumerable>;
            var runnableAssertion = fluentAssertion as IRunnableAssertion <IEnumerable>;

            var expectedEnumerable = expected as IEnumerable;

            return(assertionRunner.ExecuteAssertion(
                       () =>
            {
                EqualityHelper.IsNotEqualTo(runnableAssertion.Value, expected);
            },
                       EqualityHelper.BuildErrorMessage(runnableAssertion.Value, expectedEnumerable, false)));
        }
Beispiel #9
0
        /// <summary>
        /// Checks whether the specified <see cref="System.Object"/> is equal to this instance or not.
        /// </summary>
        /// <param name="obj">
        /// The <see cref="System.Object"/> to compare with this instance.
        /// </param>
        /// <returns>
        /// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; throws a <see cref="FluentCheckException"/> otherwise.
        /// </returns>
        /// <exception cref="FluentCheckException">
        /// The specified <see cref="System.Object"/> is not equal to this instance.
        /// </exception>
        public new bool Equals(object obj)
        {
            this.checker.ExecuteCheck(() => EqualityHelper.IsEqualTo(this.checker, obj), EqualityHelper.BuildErrorMessage(this.checker, obj, true));

            return(true);
        }