I'm using:
- nservicebus 2.0.0.0
- nservicebus.Testing 2.0.0.0
- VS2010
- nUn开发者_开发百科it
- .NET 4.0
- c#
I'm using the nservicebus.Testing namespace which nservicebus provides for testing IMessage handlers.
My tests throw this error when invoking the IMessage handler:
System.InvalidOperationException : Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.
This error goes away and the tests run fine if I remove a reference in the test project to an assembly which contains IMessages which implement generics.
NOTE that the Handler I'm testing is not handling the generics messages, the mere presence of the generics message in the bin folder is causing the error.
I would like however to be able to test handlers for IMessages which implement generics, is this possible?
cheers
The issue is that the NServiceBus testing library makes use of the same assembly type scanning logic as NServiceBus in general. In order to prevent scanning the problematic assembly, call Test.Initialize(params Assembly[] assemblies);
All that being said, it isn't recommended to have messages that make use of generics.
精彩评论