You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
automocking will fail if interfaces are decorated with the ninject named attribute.
I don't know if this is by design or a bug. (Interestingly i haven't found anyone complaining about it except me ...)
But in my opinion it would be much better if named attributes are ignored by the mocking kernel and automocked as well because the stub or mock can be configured anyway and it would be much easier if they get automocked like the rest.
I already have a working solution but i am by far no expert for ninject internals and so my solution feels a bit "unnatural". I can share it if you like though.
My idea was to create new bindings (by using IMissingBindingResolver) and manipulate their metadata so an exact match with the named attribute is generated. This way automocking works as if no named attribute is used.
Best Regards and keep up the extremly good work!
Robert Schadt
The text was updated successfully, but these errors were encountered:
Hello Team,
automocking will fail if interfaces are decorated with the ninject named attribute.
I don't know if this is by design or a bug. (Interestingly i haven't found anyone complaining about it except me ...)
But in my opinion it would be much better if named attributes are ignored by the mocking kernel and automocked as well because the stub or mock can be configured anyway and it would be much easier if they get automocked like the rest.
I already have a working solution but i am by far no expert for ninject internals and so my solution feels a bit "unnatural". I can share it if you like though.
My idea was to create new bindings (by using IMissingBindingResolver) and manipulate their metadata so an exact match with the named attribute is generated. This way automocking works as if no named attribute is used.
Best Regards and keep up the extremly good work!
Robert Schadt
The text was updated successfully, but these errors were encountered: