Re: Reflection and code replacement.
John Warner <[email protected]> Fri, 27 Feb 2009 09:10:05 -0500
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Organization | House |
| Message-ID | <046b01c998e5$17552ac0$45ff8040$@com> |
Can't answer your question. An alternate approach if I understand you correctly (and a good chance I don't) when testing the inserts use 'odd' values so the DBA at the back end can just run a delete query to clear 'you' out when the test cycle is done. In case the reflection option does not pan out... John Warner > -----Original Message----- > From: Discussion of advanced .NET topics. [mailto:ADVANCED- > [email protected]] On Behalf Of Davy J > Sent: Friday, February 27, 2009 8:59 AM > To: [email protected] > Subject: [ADVANCED-DOTNET] Reflection and code replacement. > > 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 =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives