mardi 14 avril 2015

How to mock a Generic Abstract Class using MOQ?

I'm fairly experienced when mocking interfaces and this is the 1st time that im trying to mock Generic Abstract classes. I'm updating code that a previous developer has worked on and has resigned already. I'm trying to mock a generic abstract class using MOQ, the code is as below



public abstract class AbstractView<TView, TTranslation, TProperty, TPropertyView> : TranslatableEntity<TTranslation>, IView
where TView : IView, new()
where TTranslation : ITranslation
where TProperty : BaseEntity, IProp
where TPropertyView : AbstractPropertyView<TView,TProperty>, new()
{


I saw this one here in StackOverflow but when i tried it it doesnt seem to work


StackOverflow Solution


Im getting incorrect number of Type parameters error when I try the one above.


I asked some of the people here and they also dont have a clue. Can anyone teach me how can i mock such an abstract class?


Thanks in advance


Aucun commentaire:

Enregistrer un commentaire