Re: Reflection and code replacement.
Greg Young <[email protected]> Fri, 27 Feb 2009 09:17:44 -0500
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
Look at some of the mocking frameworks. They support this, as much as I don't like the concept this is an ideal situation to use http://www.typemock.com/ Greg On Fri, Feb 27, 2009 at 8:59 AM, Davy J <[email protected]> wrote: > 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 > -- It is the mark of an educated mind to be able to entertain a thought without accepting it. =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives