RE: [snapdal-devel] c# version has been released!
Status: Beta
Brought to you by:
panmanphil
From: Philip N. <pan...@ya...> - 2004-12-15 15:02:50
|
--- Barry Sirote <ba...@si...> wrote: > Phil, > I will definitely check out the code in detail in the upcoming weeks - a > few questions off-the-cuff however: > > 1. Is this a drop-in replacement for the vb.net version. Meaning, does > it use the same signatures, etc... So that, theoretically, I could > replace the vb.net version w/o needing to do anything? We are a year from having actually made the switch, and it's not impossible that there was a change somewhere, but I believe this to be a drop in replacement. > > 2. What route did you end up taking with error handling and messages to > that effect? Ah yes, this has not changed. In your case you may need to change the code to raise an event or supply a delegate for error handling, but as all of the error handling now is directed through the DataFactory's error handler, this should be pretty easy. If you would change it so that the default would be to use the built in handler, but that a different one could be plugged in, I would incorporate this change into SnapDAL. > > 3. What the heck is a mock object? ;-) It's a big topic, but for purposes of SnapDAL its a stub on steroids. It's a stub for the underlying IDbCommand in that no call will actually be made to the database. It receives the parameters, transactions, etc. and if you desire will return a reader, datatable etc to the caller. When done, you can call the command and ask it to "Verify" that it received the correct input. In this way you are just testing your code, not the code and the database call. Your test code would look like (psuedocode only) mockCommand.SetExpectedExecuteCalls(1); mockCommand.SetExpectedTransaction(trans); mockParm1.SetExpectedValue("atest"); //run your test... mockCommand.Verify(); mockParm1.Verify(); ===== Philip - http://blogs.xcskiwinn.org/panmanphil "There's a difference between righteous anger and just being crabby" - Barbara |