lundi 29 février 2016

View model to domain model, where to test the mapping?

I'm currently experimenting with a mapping framework (automapper-like) in a MVC project.

In my controller I map the view model to the domain model (seems like the legit place to do it) using the extensions method "Map" of the framework.

Of course my code won't work if the mapping break (for instance if some property name change and causes mismatch).

But where to test the mapping work as expected?

The controller isn't the "unit" responsible of that. Neither is the View Model nor the Domain Model.

I though I could create my own wrapper (Ioc injectable instance) and unit test it with the mapping of view model to domain model bu it feels kinda awkward (how could code readers know those test need to be performed on specific classes?).

I'm kinda lost.

Aucun commentaire:

Enregistrer un commentaire