-
Notifications
You must be signed in to change notification settings - Fork 49
Calling a method that does not exists doesn't throw explicit exception #5
Copy link
Copy link
Closed
Milestone
Description
Hi
I was using the code directly in my application and I just migrated to use the Nuget, all my tests seem to pass except this one: (it was green before updating to use the Nuget)
[TestMethod]
public void it_should_throw_an_exception_if_the_method_does_not_exist()
{
var originalObject = new SimpleObject();
var sut = originalObject.AsDynamic();
Action a = () => sut.DoesNotExistMethod("dede");
a.ShouldThrow<MissingMethodException>().WithMessage("*DoesNotExistMethod*");
}
Instead it throws:
Result Message:
Expected a <System.MissingMethodException> to be thrown, but found a <System.ApplicationException>: System.ApplicationException with message "Error in the application."
at ReflectionMagic.PrivateReflectionDynamicObjectBase.InvokeMethodOnType(Type type, Object target, String name, Object[] args, IList`1 typeArgs)
at ReflectionMagic.PrivateReflectionDynamicObjectBase.InvokeMethodOnType(Type type, Object target, String name, Object[] args, IList`1 typeArgs)
at ReflectionMagic.PrivateReflectionDynamicObjectBase.InvokeMethodOnType(Type type, Object target, String name, Object[] args, IList`1 typeArgs)
at ReflectionMagic.PrivateReflectionDynamicObjectBase.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result)
at CallSite.Target(Closure , CallSite , Object , String )
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1)
It's not high severity, I just wanted to let you know
Good job, I love this tool
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels