Reflection and code replacement.

Davy J <[email protected]> Fri, 27 Feb 2009 14:59:14 +0100
Newsgroups gmane.comp.windows.devel.dotnet.advanced
Message-ID <[email protected]>
Hi,

I'm currently writing unit tests against an existing website which I'm not
able to modify the source of.

I've run into a problem where I need to test a method that is trying to
insert a record into the database.

Is there anyway of doing reflection / emit to replace the save method of the
db class with either an anoymous delegate or copy the class definition and
override the class implementations so that nothing happens?


sort of:

   DbInstance.Save = delegate(BusinessObject bo){
       return true;
   }

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives