vendredi 26 février 2016

Mocking the Children property of DirectoryEntry and the Find method of DirectoryEntries

What would be a good way to mock the Children property of System.DirectoryServices.DirectoryEntry and the Find method of DirectoryEntries? I'm trying to use the adapter pattern to wrap DirectoryEntry and DirectoryEntries, but I'm not sure how to implement the Children property:

public interface IDirectoryEntries
{
    IDirectoryEntry Find(string name);
}

public interface IDirectoryEntry
{
    .. 
    IDirectoryEntries Children { get; }
    ..
}

The Children Property if defined like this in the framework:

class DirectoryEntry
{
    ..
    public DirectoryEntries Children { get; }
    ..
}

Regards, Frank

Aucun commentaire:

Enregistrer un commentaire