예제 #1
0
    public bool NegTest1()
    {
        bool retVal = true;

        char[] charsA, charsB;

        charsA = new char[TestLibrary.Generator.GetInt32(-55) % (c_MAX_ARRAY_LENGTH + 1)];
        charsB = new char[TestLibrary.Generator.GetInt32(-55) % (c_MAX_ARRAY_LENGTH + 1)];

        TestLibrary.TestFramework.BeginScenario("NegTest1: call the method BeginInvoke");
        try
        {
            Comparison <Array> comparison  = CompareByLength;
            IAsyncResult       asyncResult = comparison.BeginInvoke(charsA, charsB, null, null);
            comparison.EndInvoke(asyncResult);

            retVal = false;
            TestLibrary.TestFramework.LogError("101", "NotSupportedException expected");
        }
        catch (NotSupportedException)
        {
            //expected
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
예제 #2
0
        /// <summary>
        /// Extends BeginInvoke<T> so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// comparison.BeginInvoke<T>(x, y, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke <T>(this Comparison <T> comparison, T x, T y, AsyncCallback callback)
        {
            if (comparison == null)
            {
                throw new ArgumentNullException("comparison");
            }

            return(comparison.BeginInvoke(x, y, callback, null));
        }