oop - Unit Testing with Moq in Visual studio 2012 -


i using moq library (moq) in visual studio 2012 (microsoft.visualstudio.testtools.unittesting) , know how write unit test class below employee class using moq.

   publc class employee      {        private deparment _objecta; //class       protected imanager  _objectb; //interface        public employee(deparment objecta, imanager  objectb)        {           _objecta=objecta;          _objectb=objectb;         }         internal void empmethod1()        {         }         internal void empmethod2()        {          }         internal void empmethod3()        {         }         }    }      public interface imanager       {           manager getmanager(int id);            void addmanager(mgrname);       } 

this duplicate from:

how mock internal method of class?

also there workaround described in following article using attributes projects:

mocking internal types moq

you can consider using non-proxy mocking library typemock, justmock or microsoft fakes.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -