question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ILdapConnection still not mockable and testable

See original GitHub issue

Hi, I have found another problem that prevents testability of your library.

Types returned from methods in the ILdapConnection interface, such as LdapResponseQueue and others have only an internal constructor.

When creating a mock of ILdapConnection for testing purposes it’s impossible to setup behaviour for such methods, as there’s no way to construct the returned type.

I am willing to work on this and send you a pull request if you agree to fix this.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Sebosekcommented, Apr 3, 2018

Can you share a sample where can I see, how you were able to mock LdapSearchResults?

1reaction
mathewbergtcommented, Nov 16, 2017

+1 Currently trying to mock LdapSearchResults with much difficulty. *Edit: I am using version 2.3.8 (from nuget). I see LdapSearchResults implements IEnumerable in the newer version. Any plans to update the nuget package?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mocking Symfony Ldap::create for unit tests
The way I have developed this plugin is to allow configuration of a number of servers to which we will connect. If we...
Read more >
Interfacing with hard-to-test third-party code
As you can see this interface is a lot simpler to mock and work with than the original one as a result it...
Read more >
Design Through Testability - An Example
So I thought we'd walk through an example to see how making code testable (which doesn't necessarily mean testing it) can turn some...
Read more >
Class MockableLDAPConnection
This class provides an implementation of an FullLDAPInterface that provides a basic means of mocking an LDAPConnection (which itself is not easily mockable...
Read more >
Holy on Dev: Mocking out LDAP/JNDI in unit tests - Jakub Holý
When unit testing a class that queries an LDAP server using ... a mock LDAP access layer so that the unit test (remember,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found