views:

30

answers:

1

Hi, how would you recommend unit testing a custom markup extension in WPF? Presumably, I need to create an instance of my markup extension and call the ProvideValue method. However, this requires an IServiceProvider, which contains an IProvideValueTarget service. How would I generate this programmatically?

+1  A: 

How much do you rely on the IServiceProvider in the implementation of the MarkupExtension? Perhaps you could just mock it out?

I've done this to test MarkupExtensions, but then I haven't relied on the IServiceProvider, so it's been fairly trivial to test...

IanR