Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access internal setter of LookupClient when doing unit testing? #509

Closed
sipsorcery opened this issue Jun 23, 2021 Discussed in #508 · 0 comments
Closed

How to access internal setter of LookupClient when doing unit testing? #509

sipsorcery opened this issue Jun 23, 2021 Discussed in #508 · 0 comments

Comments

@sipsorcery
Copy link
Member

Discussed in #508

Originally posted by henrik73 June 23, 2021
Hi

I have a solution with the SipSourcery project imported. I need to set the LookupClient in SIPDns and/or the ResolveSIPUriInternalAsync in SipTransport. The problem is that they are internals, despite there are suggestions they should be set when doing unit testing.

One solution would be to add [assembly: InternalsVisibleTo("name of assembly here")] in the SipSourcery project, but I really don't want to fork just because of this? Wouldn't it be appropriate to change the setters to be public?

Wouldn't also be more appropriate to use the interface "ILookupClient" to be able to mock?

    public static LookupClient LookupClient
    {
        get
        {
            return _lookupClient;
        }
        internal set
        {
            // Intended to allow unit testing with client options that will cause the
            // lookup logic to execute failure conditions.
            _lookupClient = value;
        }
    }</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant