Hello
How should I unit test a method I’m providing as an event handler for the MailMerge.FieldMerging
event?
The issues I face trying to test my method:
FieldMergingEventArgs
does not inherit from an interface I can mock.FieldMergingEventArgs
has an internal constructor.- I’ve made some progress refactoring my method to accept a
MailMergeContext
, but that also does not have an interface I can mock and an internal constructor (which I’ve worked around with reflection).
Even having managed to create an instance of MailMergeContext
, I can’t set or mock any of the properties in order to arrange the data I need for my tests.