Can not use Internal interfaces for mocks in tests ()

Hi,

i tried to use the Collection.QueryIndexes.CreatePrimaryIndexAsync in my code. It works, but i’m not able to use mocks in my tests and mock it because in your interface you are using internal properties.

Affected Interface:

ICollectionQueryIndexManager
/// <summary>
/// An internal collection reference for the query_context.
/// </summary>
internal ICouchbaseCollection Collection { get; set; }

/// <summary>
/// An internal scope reference for the query_context.
/// </summary>
internal IBucket Bucket { get; set; }

As a external project using your library im not able to create any mocks because i would need to be a friend assembly… There is no way to implement a internal property at all…

So please dont use the internal keyword in any public interface. Think about having two interfaces an public and an internal one if you really need to do this.

Hi @p.klein -

You can create a ticket here and we’ll see if we can improve on this. Alternatively, feel free to push a patch if you need to unblock yourself.

Jeff

Hi Jeff,

i have created:
https://issues.couchbase.com/browse/NCBC-3387
Please consider it for the next Releases.

Thank you very much
Patric

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.