c# - How can I create a unit test that verifies that all fluent validators can be resolved by Windsor? -
c# - How can I create a unit test that verifies that all fluent validators can be resolved by Windsor? -
i using fluentvalidation in application verify entities, have come little issue. validation mill setup resolve validation classes windsor attempting resolve ivalidator<entitytype>
interface.
i want create sure whenever validation class creating no 1 forgets register windsor.
essentially want @ classes in assembly implement ivalidator<entitytype>
interface , phone call windsorcontainer.resolve(typeof(ivalidator<entitytype>))
resolve type, entitytype
can class in assembly. far, using reflection have been able pull out classes derived generic interface ivalidator<>
can't figure out how proceed there. problem have find way pull out actual entity used in generic in order phone call windsor correctly, , @ loss of how that.
is there easier way this?
i want create sure whenever validation class creating no 1 forgets register windsor.
why doing this? should have installer automatically discovers these validation classes , registers them you. need test coded installer correctly.
the fact adds class implements ivalidator<tentity>
tentity
shouldn't break code!
the problem have find way pull out actual entity used in generic in order phone call windsor correctly, , @ loss of how that.
you want type.getgenericarguments
.
c# generics castle-windsor
Comments
Post a Comment