C# and Moq, raise event declared in interface from abstract class mock?

You may be able to do the desired cast if you make your mock a mult-mock. Since Moq mocks are tied to an individual type via the generic argument, you must explicitly progressively add additional interfaces or super-classes to the mock, and then use the end product in your test. A quick example of how to do this is below.

Given the way you're doing this, there is no implementation of the event. The interface itself is just the contract that says "I have a PropertyChanged event." If you want to raise that event, you have to provide a handler, even if it doesn't do anything.

Implement the PropertyChanged event in your mocked class to raise the event.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions