Ejemplo n.º 1
0
 /// <summary>
 /// Checks that the checker 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 checker value is not equal to the expected value.</exception>
 public static ICheckLink <ICheck <string> > IsEqualTo(this ICheck <string> check, object expected)
 {
     if (expected is string s)
     {
         return(IsEqualTo(check, s));
     }
     else
     {
         return(EqualityHelper.PerformEqualCheck(check, expected));
     }
 }
Ejemplo n.º 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 <int> > IsEqualTo(this ICheck <int> check, int expected)
 {
     return(EqualityHelper.PerformEqualCheck(check, expected));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Checks that the actual value is equal to another expected value using operator==.
 /// </summary>
 /// <typeparam name="T">
 /// Type of the checked value.
 /// </typeparam>
 /// <typeparam name="TU">Type of the expected 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 not equal to the expected value.
 /// </exception>
 public static ICheckLink <ICheck <T> > HasSameValueAs <T, TU>(this ICheck <T> check, TU expected)
 {
     return(EqualityHelper.PerformEqualCheck(check, expected, true));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Checks that the actual value is 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 not equal to the expected value.
 /// </exception>
 public static ICheckLink <ICheck <T> > IsEqualTo <T>(this ICheck <T> check, object expected)
 {
     return(EqualityHelper.PerformEqualCheck(check, expected));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Checks that the actual value is 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>
 /// <param name="customComparer">Reserved for future use.</param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">
 /// The actual value is not equal to the expected value.
 /// </exception>
 public static ICheckLink <ICheck <T> > IsEqualTo <T>(this ICheck <T> check, object expected, IEqualityComparer customComparer = null)
 {
     return(EqualityHelper.PerformEqualCheck(check, expected, customComparer));
 }
Ejemplo n.º 6
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 <decimal> > IsEqualTo(this ICheck <decimal> check, decimal expected)
 {
     return(EqualityHelper.PerformEqualCheck(check, expected));
 }
Ejemplo n.º 7
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
 {
     return(EqualityHelper.PerformEqualCheck(check.Not, expected));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Checks that the actual value is different from another expected value using operator!=.
 /// </summary>
 /// <typeparam name="T">
 /// Type of the checked value.
 /// </typeparam>
 /// <typeparam name="TU">Type of the expected 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> > HasDifferentValueThan <T, TU>(this ICheck <T> check, TU expected)
 {
     return(EqualityHelper.PerformEqualCheck(check.Not, expected, EqualityMode.OperatorNeq));
 }
Ejemplo n.º 9
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<ulong>> IsEqualTo(this ICheck<ulong> check, ulong expected)
 {
     return EqualityHelper.PerformEqualCheck(check , expected);
 }
Ejemplo n.º 10
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(EqualityHelper.PerformEqualCheck(runnableStructCheck, expected, false, true));
        }
Ejemplo n.º 11
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 checker = ExtensibilityHelper.ExtractStructChecker(check);

            return(EqualityHelper.PerformEqualCheck(checker, expected, false));
        }