/**
  * TODO 3:
  * Create a function called GetEvenNumbers which uses an instance of a NumberCheck delegate and an aray list of integers.
  * The function will return a list with the even numbers.
  */
 //IEnumerable merge cu yield; List nu merge
 public static IEnumerable<int> GetEvenNumbers(NumberCheck function, List<int> list)
 {
     //var newList = new List<int>();
     foreach (var number in list)
     {
         if (function(number))
         {
             //newList.Add(number);
             yield return number;
         }
     }
     //return newList;
 }
 public static ICheckLink<ICheck<float>> IsGreaterThan(this ICheck<float> check, float comparand)
 {
     var numberCheckStrategy = new NumberCheck<float>(check);
     return numberCheckStrategy.IsGreaterThan(comparand);
 }
 /// <summary>
 /// Checks that the checked value is strictly less than the comparand.
 /// </summary>
 /// <param name="check">
 /// The fluent check to be extended.
 /// </param>
 /// <param name="comparand">
 /// Comparand to compare the value to.
 /// </param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">
 /// The value is not strictly less than the comparand.
 /// </exception>
 public static ICheckLink<ICheck<long>> IsStrictlyLessThan(this ICheck<long> check, long comparand)
 {
     var numberCheckStrategy = new NumberCheck<long>(check);
     return numberCheckStrategy.IsStrictlyLessThan(comparand);
 }
 /// <summary>
 /// Checks that the actual value is NOT equal to zero.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 ///   <returns>A check link.</returns>
 /// </returns>
 /// <exception cref="FluentCheckException">The value is equal to zero.</exception>
 public static ICheckLink<ICheck<long>> IsNotZero(this ICheck<long> check)
 {
     var numberCheckStrategy = new NumberCheck<long>(check);
     return numberCheckStrategy.IsNotZero();
 }
 /// <summary>
 /// Checks that the checked value is strictly greater than the comparand.
 /// </summary>
 /// <param name="check">
 /// The fluent check to be extended.
 /// </param>
 /// <param name="comparand">
 /// Comparand to compare the value to.
 /// </param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">
 /// The checked value is not strictly greater than the comparand.
 /// </exception>
 public static ICheckLink<ICheck<double>> IsStrictlyGreaterThan(this ICheck<double> check, double comparand)
 {
     var numberCheckStrategy = new NumberCheck<double>(check);
     return numberCheckStrategy.IsStrictlyGreaterThan(comparand);
 }
 /// <summary>
 /// Checks that the actual value is negative or equal to zero.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The value is not negative or equal to zero.</exception>
 public static ICheckLink<ICheck<decimal>> IsNegativeOrZero(this ICheck<decimal> check)
 {
     var numberCheckStrategy = new NumberCheck<decimal>(check);
     return numberCheckStrategy.IsNegativeOrZero();
 }
 /// <summary>
 /// Checks that the actual value is strictly negative.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The value is not strictly positive.</exception>
 public static ICheckLink<ICheck<sbyte>> IsNegative(this ICheck<sbyte> check)
 {
     var numberCheckStrategy = new NumberCheck<sbyte>(check);
     return numberCheckStrategy.IsNegative();
 }
 /// <summary>
 /// Checks that the actual value is positive or equal to zero.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The value is not positive or equal to zero.</exception>
 public static ICheckLink<ICheck<float>> IsPositiveOrZero(this ICheck<float> check)
 {
     var numberCheckStrategy = new NumberCheck<float>(check);
     return numberCheckStrategy.IsPositiveOrZero();
 }
        #pragma warning disable 169

        //// ---------------------- WARNING ----------------------
        //// AUTO-GENERATED FILE WHICH SHOULD NOT BE MODIFIED!
        //// To change this class, change the one that is used
        //// as the golden source/model for this autogeneration
        //// (i.e. the one dedicated to the integer values).
        //// -----------------------------------------------------

        // Since this class is the model/template for the generation of all the other signed numbers related CheckExtensions classes, don't forget to re-generate all the other classes every time you change this one. To do that, just save the ..\T4\NumberFluentAssertionGenerator.tt file within Visual Studio 2012. This will trigger the T4 code generation process.

        /// <summary>
        /// Checks that the actual value is strictly positive.
        /// </summary>
        /// <param name="check">The fluent check to be extended.</param>
        /// <returns>
        /// A check link.
        /// </returns>
        /// <exception cref="FluentCheckException">The value is not strictly positive.</exception>
        public static ICheckLink <ICheck <float> > IsPositive(this ICheck <float> check)
        {
            var numberCheckStrategy = new NumberCheck <float>(check);

            return(numberCheckStrategy.IsPositive());
        }
Example #10
0
 public static ICheckLink<ICheck<short>> IsLessThan(this ICheck<short> check, short comparand)
 {
     var numberCheckStrategy = new NumberCheck<short>(check);
     return numberCheckStrategy.IsLessThan(comparand);
 }
 public static ICheckLink<ICheck<ulong>> IsGreaterThan(this ICheck<ulong> check, ulong comparand)
 {
     var numberCheckStrategy = new NumberCheck<ulong>(check);
     return numberCheckStrategy.IsGreaterThan(comparand);
 }
 private void tbPrice_PreviewTextInput_1(object sender, TextCompositionEventArgs e)
 {
     e.Handled = !NumberCheck.IsNumber(e.Text);
 }
        #pragma warning disable 169

        //// ---------------------- WARNING ----------------------
        //// AUTO-GENERATED FILE WHICH SHOULD NOT BE MODIFIED!
        //// To change this class, change the one that is used
        //// as the golden source/model for this autogeneration
        //// (i.e. the one dedicated to the integer values).
        //// -----------------------------------------------------

        // Since this class is the model/template for the generation of all the other signed numbers related CheckExtensions classes, don't forget to re-generate all the other classes every time you change this one. To do that, just save the ..\T4\NumberFluentAssertionGenerator.tt file within Visual Studio 2012. This will trigger the T4 code generation process.

        /// <summary>
        /// Checks that the actual value is strictly positive.
        /// </summary>
        /// <param name="check">The fluent check to be extended.</param>
        /// <returns>
        /// A check link.
        /// </returns>
        /// <exception cref="FluentCheckException">The value is not strictly positive.</exception>
        public static ICheckLink<ICheck<short>> IsPositive(this ICheck<short> check)
        {
            var numberCheckStrategy = new NumberCheck<short>(check);
            return numberCheckStrategy.IsPositive();
        }
 public void Setup() => _check = new NumberCheck();
 /// <summary>
 /// Checks that the actual value is strictly positive.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The value is not strictly positive.</exception>
 public static ICheckLink<ICheck<decimal>> IsStrictlyPositive(this ICheck<decimal> check)
 {
     var numberCheckStrategy = new NumberCheck<decimal>(check);
     return numberCheckStrategy.IsStrictlyPositive();
 }
 /// <summary>
 /// Checks that the checked value is strictly greater than the comparand.
 /// </summary>
 /// <param name="check">
 /// The fluent check to be extended.
 /// </param>
 /// <param name="comparand">
 /// Comparand to compare the value to.
 /// </param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">
 /// The checked value is not strictly greater than the comparand.
 /// </exception>
 public static ICheckLink<ICheck<ushort>> IsStrictlyGreaterThan(this ICheck<ushort> check, ushort comparand)
 {
     var numberCheckStrategy = new NumberCheck<ushort>(check);
     return numberCheckStrategy.IsStrictlyGreaterThan(comparand);
 }
 /// <summary>
 /// Checks that the actual value is equal to zero.
 /// </summary>
 /// <param name="check">The fluent check to be extended.</param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">The value is not equal to zero.</exception>
 public static ICheckLink<ICheck<ushort>> IsZero(this ICheck<ushort> check)
 {
     var numberCheckStrategy = new NumberCheck<ushort>(check);
     return numberCheckStrategy.IsZero();
 }
        /// <summary>
        /// Checks that the actual value is strictly negative.
        /// </summary>
        /// <param name="check">The fluent check to be extended.</param>
        /// <returns>
        /// A check link.
        /// </returns>
        /// <exception cref="FluentCheckException">The value is not strictly positive.</exception>
        public static ICheckLink <ICheck <short> > IsNegative(this ICheck <short> check)
        {
            var numberCheckStrategy = new NumberCheck <short>(check);

            return(numberCheckStrategy.IsNegative());
        }
 public static ICheckLink<ICheck<float>> IsNegative(this ICheck<float> check)
 {
     var numberCheckStrategy = new NumberCheck<float>(check);
     return numberCheckStrategy.IsStrictlyNegative();
 }
Example #20
0
 public static ICheckLink<ICheck<byte>> IsLessThan(this ICheck<byte> check, byte comparand)
 {
     var numberCheckStrategy = new NumberCheck<byte>(check);
     return numberCheckStrategy.IsLessThan(comparand);
 }
Example #21
0
 /// <summary>
 /// Checks that the actual value is more than an operand.
 /// </summary>
 /// <param name="check">
 /// The fluent check to be extended.
 /// </param>
 /// <param name="comparand">
 /// Comparand to compare the value to.
 /// </param>
 /// <returns>
 /// A check link.
 /// </returns>
 /// <exception cref="FluentCheckException">
 /// The value is not less than the comparand.
 /// </exception>
 public static ICheckLink<ICheck<decimal>> IsGreaterThan(this ICheck<decimal> check, decimal comparand)
 {
     var numberCheckStrategy = new NumberCheck<decimal>(check);
     return numberCheckStrategy.IsGreaterThan(comparand);
 }
Example #22
0
        public ActionResult CheckNumber(double input)
        {
            ViewBag.Result = NumberCheck.CheckNumber(input);

            return(View());
        }