I'm having some troubl开发者_如何学运维e 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?
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.
精彩评论