would be a reasonable test. Currently, the Monitor() extension method throws an exception saying the object has no events. From looking at the code, it would appear this is because it depends on the Type.GetEvents() method, which does not consider interface inheritance in its examination. As far as I'm concerned, that would easily be argued as a bug in the .NET Framework, but given how long it's been there and the potentially breaking nature of a change, I don't imagine we will see it changed ever.
Replacing this code is likely non-trivial, but not overly hard either (and if I have time I will try to get around to it if nobody beats me to the punch), given that interfaces show up differently in the type hierarchy than base classes do.
Ignoring the contrived nature of cast to ITest in the above sample, the problem is showing up for me when trying to write tests to the interface (ie. the contract) when I don't know the object implementing it because I have the same tests for multiple objects implementing the interface (Liskov substitution).
The text was updated successfully, but these errors were encountered: