Friday 15 August 2014

.net - Mocking a Static Class -


I have a static class that wraps some of the basic methods by winspool:

  Public static class WinSpool {[DllImport ("winspool.drv")] Public static extern int OpenPrinter (string pPrinterName, Outside IntPtr phPrinter, IntPtr pDefault); ... // some other methods here}  

I want to duplicate them for unit testing, but could not find a pattern for it. (Do all have to save static classes?)

Yes, stable class usually happens at AAAIK Open Source Mocking framework (like) supports stable class jokes

If you want to duplicate the static class absolutely and positively, then I am afraid you should go, which is not free is.


No comments:

Post a Comment