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
I would really like to mock ITikConnection.Save and many other functions but they are implemented as extension methods. Is that really necessary? What are the reasons for implementing most of the library as extension methods?
The text was updated successfully, but these errors were encountered:
I believe that unit-testing controlers is not goog idea (no real logic inside) and loading/saving code is very similar.
How to test your code (just brainstorming):
Use some kind of mikrotik facade abstraction (like DAO/Service layer) and mock this facade (e.q. LoadAllEthBasedInterfaces(), LoadAllActiveUsers(), DisableMikrotikUserByName(name)). It also helps with CQS. This facade itself is controller (from my perspective) and should not be unit-tested.
Mock whole ITikConnection and ITikCommand (pretend mikrotik communication) - could be very hard work
BTW: I have plan to create some kind of mikrotikwrapper class (wraps connection) with easy to use API (like mikrotik.Users.Create(name, ...); and I will face the same problem there - so - may be, I will recognize I am wrong :-)
I would really like to mock
ITikConnection.Save
and many other functions but they are implemented as extension methods. Is that really necessary? What are the reasons for implementing most of the library as extension methods?The text was updated successfully, but these errors were encountered: