/// <summary>
        /// Asserts the specified test method throws an <see cref="ArgumentException">argument exception</see>.
        /// </summary>
        /// <typeparam name="TException">The <see cref="Type">type</see> of <see cref="ArgumentException"/> to expect.</typeparam>
        /// <param name="assert">The extended <see cref="Asserter"/>.</param>
        /// <param name="testMethod">The <see cref="Action"/> representing the test method.</param>
        /// <param name="paramName">The name of the parameter expected to throw an exception.</param>
        /// <param name="message">A message to display if the assertion fails. This message can be seen in the unit test results.</param>
        /// <param name="parameters">An array of parameters to use when formatting <paramref name="message" />.</param>
        /// <returns>The <see cref="ExceptionAsserter{T}">asserted exception</see>.</returns>
        /// <include file="examples.xml" path="Types/Type[@name='ExceptionExtensions']/Member[@name='ThrowsForArgument`1']/example[2]" />
        public static ExceptionAsserter <TException> ThrowsForArgument <TException>(this Asserter assert, Action testMethod, string paramName, string message, params object[] parameters) where TException : ArgumentException
        {
            Arg.NotNull(assert, nameof(assert));
            Contract.Ensures(Contract.Result <ExceptionAsserter <TException> >() != null);

            assert.AssertParameterIsNotNull(testMethod, nameof(testMethod));

            var assertion   = assert.Throws <TException>(testMethod, message, parameters);
            var actualParam = assertion.Exception.ParamName;

            assert.AreEqual(paramName, actualParam, WrongParameterName, paramName, actualParam);

            return(assertion);
        }
        static ExceptionAsserter <TException> ThrowsIfArgumentIs <TArg, TException>(this Asserter assert, Expression <Action <TArg> > testMethod, TArg value, string message, params object[] parameters) where TException : ArgumentException
        {
            Arg.NotNull(assert, nameof(assert));
            Arg.NotNull(assert, nameof(testMethod));
            Contract.Ensures(Contract.Result <ExceptionAsserter <TException> >() != null);

            assert.AssertParameterIsNotNull(testMethod, nameof(testMethod));

            var test          = testMethod.Compile();
            var assertion     = assert.Throws <TException>(() => test(value), message, parameters);
            var expectedParam = testMethod.Parameters.First().Name;
            var actualParam   = assertion.Exception.ParamName;

            assert.AreEqual(expectedParam, actualParam, WrongParameterName, expectedParam, actualParam);

            return(assertion);
        }
 /// <summary>
 /// Asserts the specified test method throws an exception of the specified type.
 /// </summary>
 /// <typeparam name="TException">The <see cref="Type"/> of <see cref="ArgumentException"/> that should be thrown.</typeparam>
 /// <param name="assert">The extended <see cref="Asserter"/>.</param>
 /// <param name="testMethod">The <see cref="Action"/> representing the test method.</param>
 /// <returns>The <see cref="ExceptionAsserter{T}">asserted exception</see>.</returns>
 /// <include file="examples.xml" path="Types/Type[@name='ExceptionExtensions']/Member[@name='Throws`1']/example[1]" />
 public static ExceptionAsserter <TException> Throws <TException>(this Asserter assert, Action testMethod) where TException : Exception =>
 assert.Throws <TException>(testMethod, ExceptionOfTNotThrown, typeof(TException));
 /// <summary>
 /// Asserts the specified test method throws an exception of any type.
 /// </summary>
 /// <param name="assert">The extended <see cref="Asserter"/>.</param>
 /// <param name="testMethod">The <see cref="Action"/> representing the test method.</param>
 /// <returns>The <see cref="ExceptionAsserter{T}">asserted exception</see>.</returns>
 /// <include file="examples.xml" path="Types/Type[@name='ExceptionExtensions']/Member[@name='Throws']/example[1]" />
 public static ExceptionAsserter <Exception> Throws(this Asserter assert, Action testMethod) => assert.Throws(testMethod, ExceptionNotThrown);