Pergunta

I'm having some trouble unit testing the model returned by DefaultModelBinder. I want to feed in a fake form collection and check the model that it returns to make sure model properties are being bound properly. In my research, I'm not turning up -any- resources on testing the DefaultModelBinder. Maybe I'm missing something. Maybe I shouldn't be testing this part of MVC? Your thoughts?

Foi útil?

Solução

Byron, I really think you shouldn't be testing this. You have to focus on your controller actions and the interactions they may have with other components, like services, etc. The default model binder has already been tested by the MS team (I hope so :P). Just assume your action parameters have correctly been populated with the form posted values by the default model binder and test the actions in your controllers with objects built by yourself. This is what I usually do and what I have seen everywhere.

Regards.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top