title: IoC and Microsoft classes
body: <p>I'm new to using an Ioc, and am wondering how, if at all, I should be injecting Microsoft classes. Specifically, I am using DirectorySearcher. Can I inject this? I don't think so.</p>
  
  <p>So I made a wrapper class for DirectorySearcher, and created a factory method. So I could inject my wrapper class where I needed it, and call the factory 'Create' method. Is this the way to handle this type of situation? Or do I need a whole Factory class?</p>
  
  <pre><code>public class Directory
  {
      public Directory() { }
      public static Directory Create(string userName, string password, string ldapPath)
      {
          var entry = new DirectoryEntry(path, userName, password, AuthenticationTypes.Secure);
          var searcher = new DirectorySearcher(entry);
          return new Directory() { Searcher = searcher }; 
      }
  }
  </code></pre>
  
  <p>My concern is that my wrapper is tightly coupled to DirectorySearcher. To test, I really need to access my live AD.</p>