Unit tests for code accessing ActiveDirectory

前端 未结 2 1213
梦毁少年i
梦毁少年i 2021-02-20 04:49

What\'s the best way to unit test an application accessing the ActiveDirectory and/or mock the dependencies to the AD?

All the required types such as DirectorySear

相关标签:
2条回答
  • 2021-02-20 05:17

    If they're not mockable (don't have MSDN at hand, so I can't really tell), you can always abstract them behind an IDirectorySearcher and IDirectoryEntry and mock these. With this approach you can simplify the API by tailoring it specifically to suit your needs.

    0 讨论(0)
  • 2021-02-20 05:18

    Is there no other possibility to use a leightweight directory server (ldap) like java developers do with Apache DS (http://directory.apache.org) in .NET?!

    This would be a nice alternative.

    0 讨论(0)
提交回复
热议问题