title: Best practices with Unit testing on Third Party software API's (AutoCAD)
body: <p>We are developing applications for use within AutoCAD.
  Basically we create a Class Library Project, and load the .dll in AutoCAD with a command (NETLOAD).</p>
  <p>As so, we can use commands, &quot;palettes&quot;, user controls, forms etc...</p>
  <p>AutoDesk provides an API through some dll's, running in their program directory.
  When referencing these dll's you can only call the dll's at runtime while loading your app in AutoCAD (This is a licensing security from AutoDesk).</p>
  <p>For us, while developing, this is not a problem, we need to visually test within the context of AutoCAD, so we just set the Debug Properties so that they start acad.exe and load our dll with a script in the acad.exe parameters.</p>
  <p>The problem is, when trying to unit test our code, NUnit or mstest are not running from within the AutoCAD context and they also cannot start it.
  There exist a tool called Gallio, which has provided an interface with AutoCAD, so that it can run Unit test through IPC with Named Pipes.</p>
  <p>However, this solution is, for me, too much of a hassle. I want to be able to quickly write tests without having to leave my beloved IDE.</p>
  <p>So, what, from a &quot;good design view&quot; would be a good approach to this problem? I'm thinking I would basically need a testable codebase which is not referencing the AutoCAD dll's and a non-testable that does references the untestable AutoCAD dll's.</p>
  <p>I'm sure there are ways to get this to work: ( IOC, DI, Adapter Pattern,. .) I just don't these principles in depth and thus I don't know which route will best suit my purposes and goals.</p>