public void Overload2(MockEntity_Validation e)
 {
 }
        public void ValidationUtilities_FindsRightMethod()
        {
            MockEntity_Validation entity = new MockEntity_Validation();

            object[] parameters = new object[] { 5 };
            MethodInfo method = ValidationUtilities.GetMethod(entity, "Overload", parameters);
            Assert.AreEqual(typeof(int), method.GetParameters()[0].ParameterType);

            method = ValidationUtilities.GetMethod(entity, "Method", parameters);
            Assert.AreEqual("Method", method.Name);

            // calling overloaded method
            parameters = new object[] { entity };
            ExceptionHelper.ExpectException<AmbiguousMatchException>(delegate
            {
                ValidationUtilities.GetMethod(entity, "Overload2", parameters);
            }, string.Format(Resource.ValidationUtilities_AmbiguousMatch, "Overload2"));

            // calling non existent method
            ExceptionHelper.ExpectException<MissingMethodException>(delegate
            {
                ValidationUtilities.GetMethod(entity, "NonExistentMethod", parameters);
            }, string.Format(Resource.ValidationUtilities_MethodNotFound, "OpenRiaServices.DomainServices.Client.Test.MockEntity_Validation", "NonExistentMethod", parameters.Length, "'OpenRiaServices.DomainServices.Client.Test.MockEntity_Validation'"));

            // calling with empty parameter collection
            parameters = new object[] { };
            ExceptionHelper.ExpectException<MissingMethodException>(delegate
            {
                ValidationUtilities.GetMethod(entity, "Method", parameters);
            }, string.Format(Resource.ValidationUtilities_MethodNotFound_ZeroParams, "OpenRiaServices.DomainServices.Client.Test.MockEntity_Validation", "Method"));

            // calling with null parameter collection
            parameters = null;
            ExceptionHelper.ExpectException<MissingMethodException>(delegate
            {
                ValidationUtilities.GetMethod(entity, "Method", parameters);
            }, string.Format(Resource.ValidationUtilities_MethodNotFound_ZeroParams, "OpenRiaServices.DomainServices.Client.Test.MockEntity_Validation", "Method"));

            // calling with different data types and null in parameter collection, method takes less parameters
            parameters = new object[] { 1, true, "hello", null, entity, new object() };
            ExceptionHelper.ExpectException<MissingMethodException>(delegate
            {
                ValidationUtilities.GetMethod(entity, "Method", parameters);
            }, string.Format(Resource.ValidationUtilities_MethodNotFound, "OpenRiaServices.DomainServices.Client.Test.MockEntity_Validation", "Method", 6, "'System.Int32', 'System.Boolean', 'System.String', null, 'OpenRiaServices.DomainServices.Client.Test.MockEntity_Validation', 'System.Object'"));

            // calling with different data types and null in parameter collection, method takes same number of parameters
            ExceptionHelper.ExpectException<MissingMethodException>(delegate
            {
                ValidationUtilities.GetMethod(entity, "MethodWith6Params", parameters);
            }, string.Format(Resource.ValidationUtilities_MethodNotFound, "OpenRiaServices.DomainServices.Client.Test.MockEntity_Validation", "MethodWith6Params", 6, "'System.Int32', 'System.Boolean', 'System.String', null, 'OpenRiaServices.DomainServices.Client.Test.MockEntity_Validation', 'System.Object'"));

        }