Exemple #1
0
        // Since this class is the model/template for the generation of all the other numbers related FluentAssertionExtensions 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 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 <int> > IsEqualTo(this IFluentAssertion <int> fluentAssertion, object expected)
        {
            // TODO transform NumberFluentAssertion<T> into a static class with functions only?
            var numberAssertionStrategy = new NumberFluentAssertion <int>(fluentAssertion);

            return(numberAssertionStrategy.IsEqualTo(expected));
        }
Exemple #2
0
        /// <summary>
        /// Checks that the actual instance is an instance of the given type.
        /// </summary>
        /// <typeparam name="T">The expected Type of the instance.</typeparam>
        /// <param name="fluentAssertion">The fluent assertion to be extended.</param>
        /// <returns>
        /// A chainable fluent assertion.
        /// </returns>
        /// <exception cref="FluentAssertionException">The actual instance is not of the provided type.</exception>
        public static IChainableFluentAssertion <IFluentAssertion <int> > IsInstanceOf <T>(this IFluentAssertion <int> fluentAssertion)
        {
            var numberAssertionStrategy = new NumberFluentAssertion <int>(fluentAssertion);

            return(numberAssertionStrategy.IsInstanceOf <T>());
        }
Exemple #3
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 <int> > IsNotEqualTo(this IFluentAssertion <int> fluentAssertion, object expected)
        {
            var numberAssertionStrategy = new NumberFluentAssertion <int>(fluentAssertion);

            return(numberAssertionStrategy.IsNotEqualTo(expected));
        }
Exemple #4
0
        /// <summary>
        /// Checks that the actual value is more than an operand.
        /// </summary>
        /// <param name="fluentAssertion">
        /// The Fluent assertion to be extended.
        /// </param>
        /// <param name="comparand">
        /// Comparand to compare the value to.
        /// </param>
        /// <returns>
        /// A chainable assertion.
        /// </returns>
        /// <exception cref="FluentAssertionException">
        /// The value is not less than the comparand.
        /// </exception>
        public static IChainableFluentAssertion <IFluentAssertion <int> > IsGreaterThan(this IFluentAssertion <int> fluentAssertion, int comparand)
        {
            var numberAssertionStrategy = new NumberFluentAssertion <int>(fluentAssertion);

            return(numberAssertionStrategy.IsGreaterThan(comparand));
        }
Exemple #5
0
        /// <summary>
        /// Checks that the actual value is strictly positive.
        /// </summary>
        /// <param name="fluentAssertion">The fluent assertion to be extended.</param>
        /// <returns>
        /// A chainable assertion.
        /// </returns>
        /// <exception cref="FluentAssertionException">The value is not strictly positive.</exception>
        public static IChainableFluentAssertion <IFluentAssertion <int> > IsPositive(this IFluentAssertion <int> fluentAssertion)
        {
            var numberAssertionStrategy = new NumberFluentAssertion <int>(fluentAssertion);

            return(numberAssertionStrategy.IsPositive());
        }
Exemple #6
0
        /// <summary>
        /// Checks that the actual value is less than an operand.
        /// </summary>
        /// <param name="fluentAssertion">
        /// The Fluent assertion to be extended.
        /// </param>
        /// <param name="comparand">
        /// Comparand to compare the value to.
        /// </param>
        /// <returns>
        /// A chainable assertion.
        /// </returns>
        /// <exception cref="FluentAssertionException">
        /// The value is not less than the comparand.
        /// </exception>
        public static IChainableFluentAssertion <IFluentAssertion <decimal> > IsLessThan(this IFluentAssertion <decimal> fluentAssertion, decimal comparand)
        {
            var numberAssertionStrategy = new NumberFluentAssertion <decimal>(fluentAssertion);

            return(numberAssertionStrategy.IsLessThan(comparand));
        }
Exemple #7
0
        /// <summary>
        /// Checks that the actual value is NOT equal to zero.
        /// </summary>
        /// <param name="fluentAssertion">The fluent assertion to be extended.</param>
        /// <returns>
        ///   <returns>A chainable assertion.</returns>
        /// </returns>
        /// <exception cref="FluentAssertionException">The value is equal to zero.</exception>
        public static IChainableFluentAssertion <IFluentAssertion <decimal> > IsNotZero(this IFluentAssertion <decimal> fluentAssertion)
        {
            var numberAssertionStrategy = new NumberFluentAssertion <decimal>(fluentAssertion);

            return(numberAssertionStrategy.IsNotZero());
        }
Exemple #8
0
        /// <summary>
        /// Checks that the actual value is equal to zero.
        /// </summary>
        /// <param name="fluentAssertion">The fluent assertion to be extended.</param>
        /// <returns>
        /// A chainable assertion.
        /// </returns>
        /// <exception cref="FluentAssertionException">The value is not equal to zero.</exception>
        public static IChainableFluentAssertion <IFluentAssertion <ushort> > IsZero(this IFluentAssertion <ushort> fluentAssertion)
        {
            var numberAssertionStrategy = new NumberFluentAssertion <ushort>(fluentAssertion);

            return(numberAssertionStrategy.IsZero());
        }