Thursday, June 30, 2005

Create new entry points to enable unit testing of Legacy code

If you've been reading the Shade Tree Developer this week you'll know that I'm fighting with a legacy component. I was trying to get a piece of code into NUnit to test my new functionality. A class in the stack works by giving it a key value to a record in the database. I tried for awhile to use an existing stored procedure to push in test data. Guess what I found? I had relational integrity issues with setting up the test data, but so what, that's just what a database is. I wasted a bit of time pushing past the referential integrity by getting the correct data and stumble right into security authorization being performed inside the f***ing stored procedure!

It was about this time I remembered what I had been reading in the Feathers book on legacy code. Sometimes you have to change the code just to get it into the test harness. A quick "CTRL-ALT-M" action with ReSharper, and voila, an entry point into the business logic that bypasses the database and security checks. Add some ObjectMother magic to construct the fugly data structures, and I've got a working unit-ish test.

Moral of the story? Don't be afraid to change the code first before writing a test (well, maybe afraid but not terrified). Remembering to backup and look for an easier way to write a test was probably a good idea too.

38 Comments:

Anonymous Info Products said...

Hi Jeremy D. Miller, As you are probably aware, there are so many junk filled blogs. As I was searching for Resell Rights related information today, it was a nice break from the 'usual' to come across your blog. I am happy I searched for Resell Rights related ideas today. Thanks.

6:10 AM, October 27, 2005  
Anonymous business plan template said...

Hi Jeremy D. Miller! You have a great blog over here!
Please accept my compliments and wishes for your happiness and success!

If you have a moment, please take a look at my site:
business mailing lists
It covers business mailing lists related stuff.
Have a great day!

12:54 AM, November 12, 2005  
Anonymous free data entry tests said...

Well done on a nice blog Jeremy D. Miller. I was looking for information on free data entry tests and came across your post Create new entry points to enable unit testing of Legacy code - not precisely what I was looking for related to free data entry tests but an interesting read all the same!

2:34 PM, November 19, 2005  
Anonymous bar code solutions said...

Well done on a nice blog Jeremy D. Miller. I was looking for information on bar code printers and came across your post Create new entry points to enable unit testing of Legacy code - not quite what I was looking for related to bar code printers but interesting all the same!

9:48 AM, November 20, 2005  
Blogger online2u said...

Free Online Mortage Quote!

1:58 PM, November 22, 2005  
Anonymous online jobs said...

Hi there Jeremy D. Miller, I was just browsing, looking for Work at Home blogs and found yours. Very Nice! If you're a stay-at-home mom, student, home maker or just someone in need of some extra cash, here's an Ideal Opportunity! You can get paid submitting and entering data online and make an extra $300-$1000+ per day with only 30 mins daily. Go to data entry work for more info and to join! It's RISK FREE with a 60-day
money back guarantee. :)

7:25 PM, January 14, 2006  
Anonymous Anonymous said...

Ah...such a great blog you have here. I have truly enjoyed all the data entry jobs at home related info you have here. It will help me on my quest to help others who are looking for a perfect data entry job from home.

4:01 PM, February 27, 2006  
Blogger answer-man said...

ps I'm having a little trouble sending comments so if I do it twice please excuse me and I apologize.

6:07 AM, March 16, 2006  
Anonymous grcr1 said...

Enjoying your blog, it's fantastic work!

Nice blogging day,
online home jobs with data entry

3:55 PM, July 15, 2006  
Anonymous data entry program said...

Enjoying your blog, it's good work!

Nice blogging day,
data entry program

7:47 PM, July 15, 2006  
Anonymous data entry money said...

Keep your blog going, it's great!

Happy posting,
data entry money

8:38 PM, July 20, 2006  
Anonymous data entry outsourcing said...

Good going on your blog, i've enjoyed it, glad I found it.

Good Day,
data entry outsourcing

5:19 PM, July 21, 2006  
Anonymous data entry work at home jobs no fee said...

All I can say is ...wow! Simply liking your site, good posts and very cool.

Have A Nice blogging day,
data entry work at home jobs no fee

2:02 AM, July 23, 2006  
Anonymous Anonymous said...

http://www.sicab.org/sicab/foro/cheap-phentermine-online.html cheap phentermine online cheap phentermine online

6:17 PM, December 31, 2006  
Anonymous Anonymous said...

http://www.sicab.org/sicab/foro/discount-phentermine.html discount phentermine discount phentermine

11:08 PM, January 02, 2007  
Anonymous Anonymous said...

AMSO, AMSO Managed Care Forum. AMTR, AMTRAK Train Schedules
[url=http://www.planetnana.co.il/forumnews02/cheap-viagra-online.html]cheap viagra online[/url]
[url=http://www.forumnews03.kokoom.com/index.html]Acne At Huge Discount! Free Shipping On Acne[/url]

5:21 PM, January 05, 2007  
Anonymous Anonymous said...

FREEDOM HEPPINESS HEALTH ....BUY LOW-COST VIAGRA , CHEAP CIALIS LEVITRA ONLINE
Sildenafil citrate, sold under the name Viagra is the first of a new group of medication which allows adequate sexual stimulation, relaxes the blood vessels of the penis and helps erection..More info
AND FREE OF CHARGE TO YOUR HOME DELIVERY


Can I japanese free teen lesbian sex anime porn the hardcore cum



Premium dating site for adult single dating and sexy swinger,





swaying free adult sex chat room and pointing down




MILF close up black lustful dick screwing



porno gay porno storie free porno videoafrica xxx moms and son porno porno video



Check them out if you can't find new pics on most of the sites listed here.




japanese animation porno xxx free animation gay sex




I lay there for a while longer and then slowly stood




Lesbian sex porn free black lesbian having sex her .



full picture or html porno video free avi little girls having mature sex

10:41 PM, January 10, 2007  
Anonymous Anonymous said...

Hello!

Nice site, keep up the good work .

http://buy-phentermine.hem.nu BUY PHENTERMINE
BUY PHENTERMINE
http://blog.sol.no/buy-phentermine
BUY PHENTERMINE
http://buy-phentermine.hem.nu buy phentermine
http://buy-phentermine.hem.nu phentermine online
http://buy-phentermine.hem.nu order phentermine
http://buy-phentermine.hem.nu cheap phentermine
http://buy-phentermine.hem.nu buy phentermine online
http://buy-phentermine.hem.nu phentermine diet pill
http://buy-phentermine.hem.nu phentermine online pharmacy
http://buy-phentermine.hem.nu phentermine prescription
http://buy-phentermine.hem.nu what is phentermine
http://buy-phentermine.hem.nu free phentermine

1:35 AM, January 20, 2007  
Anonymous Anonymous said...

Good day!
Only for your car! immobilizer read ECUReader visa has cracked!

admiral dashboard
admiral air bag
admiral does not work
admiral key
admiral ecu

Thank you!

7:32 AM, January 26, 2007  
Anonymous Anonymous said...

Cialis is the only drug which is not only fast acting (works in 30 minutes) but is also know to be effective for as long as 36 hours, thus enabling you to choose the moment that is just right for you as well as your partner[url=http://www.forums.MEDEXTREME.BIZ]buy cheap CIALIS online[/url]

12:55 PM, February 01, 2007  
Anonymous Anonymous said...

Free Newsletters, Manage Your Subscriptions, Online Forums, INFORMATION
buy cheap VIAGRA online

GoldenCasino.com - An incredible online casino experience offering blackjack, roulette, craps, slots, and video poker. Deposit now and get up to $555 FREE!

Looking for bmw? Quickly find links to all the best bmw sites. You will find Quality information about bmw at Informed Auto

discontinued born shoes

electric foot warmer boot
boot warmer
born shoe outlets

10:14 PM, February 04, 2007  
Anonymous Anonymous said...

www.adult-ecard.carmodelrank.com www.karas-adult-playground.phpsolve.com www.porn-for-pyros.carmodelrank.com
www.ducky-porn.carmodelrank.com/ducky-porn.htm

6:22 AM, February 08, 2007  
Anonymous Anonymous said...

Welcome to online community. Interesting OnLine STUFF .!

OEM Download Software & Support Overview
* Most software titles are available immediately or within a few hours!
* Ultra Fast download connection most download software titles to be downloaded in less than a hour on DSL or Cable connection
* Customer support on all download software and free upgrades available for up to 1 year.


all oem programs are the 100% full working retail versions - no demos or academic versions!
Adobe Acrobat 7.0 Pro.
Adobe Photoshop CS2 + Image ready CS2.
Alias Maya 7.0 Unlimited.
Ansys Multiphysics 10.0
Autocad 2006
Crystal Reports Server 11 Full Version
Macromedia Dreamweaver 8 Microsoft Office 2003 Professional Edition
Microsoft Windows Server 2003 Enterprise Edition.Symantec Norton Internet Security™ 2006

12:05 PM, February 17, 2007  
Anonymous Anonymous said...

Hey, you have a great blog here! I'm definitely going to bookmark you!

I have a Work At Home blog. It pretty much covers home based business related stuff.

Come and check it out if you get time :-)

9:08 PM, February 23, 2007  
Anonymous Anonymous said...

[i][b]BUY CHEAP SUPER VIAGRA ONLINE AND SAVE 70 % OF MONEY...[/b][/i]
[url=http://www.drugsmarket.medsjoy.biz]BUY LOW-COST VIAGRA ONLINE[/url]
[url=http://www.creditcardforums.kokoom.com]CREDIT CARDS RATES[/url]

4:18 AM, February 26, 2007  
Anonymous Anonymous said...

Watiti.com adult dating
Join me and my circle of friends at http://www.watiti.com, an online social networking community that connects people from all over the world.

Meet new people, share photos, create or attend events, post free classifieds, send free e-cards, listen music, read blogs, upload videos, be part of a club, chat rooms, forum and much more!

See you around! Bring all your friends too!

Watiti.com adult dating

4:39 AM, February 27, 2007  
Anonymous Anonymous said...

http://www.adquity.com

Classifieds for our community. Buy, sell, trade, date, events... post anything. Adquity Classifieds.

http://www.adquity.com

8:26 PM, March 01, 2007  
Anonymous Anonymous said...

Hello!

Nice site, keep up the good work .

http://buy-phentermine.hem.nu BUY PHENTERMINE
BUY PHENTERMINE
http://blogg.sol.no/buy-phentermine
BUY PHENTERMINE

http://lesbian-school.moviesparisexposed.info/ LESBIAN SCHOOL
http://hot-school-teacher-naked.moviesparisexposed.info/ HOT SCHOOL TEACHER NAKED
http://sex-personals.moviesparisexposed.info/ SEX PERSONALS
http://virgin-blowjob.moviesparisexposed.info/ VIRGIN BLOWJOB
http://rabbit-vibrator.moviesparisexposed.info/ RABBIT VIBRATOR
http://college-group-orgy.moviesparisexposed.info/ COLLEGE GROUP ORGY
http://horny-school-teachers.moviesparisexposed.info/ HORNY SCHOOL TEACHERS
http://video-strip-poker.moviesparisexposed.info/ VIDEO STRIP POKER
http://adult-incontinence-product.moviesparisexposed.info/ ADULT INCONTINENCE PRODUCT
http://gothic-blowjob.moviesparisexposed.info/ GOTHIC BLOWJOB
http://blowjob-cartoon.moviesparisexposed.info/ BLOWJOB CARTOON
http://school-naked.moviesparisexposed.info/ SCHOOL NAKED
http://college-with-big-tits.moviesparisexposed.info/ COLLEGE WITH BIG TITS
http://bikini-blowjob.moviesparisexposed.info/ BIKINI BLOWJOB
http://college-fuck-fest-clips.moviesparisexposed.info/ COLLEGE FUCK FEST CLIPS
http://teen-masturbation-education.moviesparisexposed.info/ TEEN MASTURBATION
http://after-school-sex.moviesparisexposed.info/ AFTER SCHOOL SEX
http://college-hotties.moviesparisexposed.info/ COLLEGE HOTTIES

6:58 AM, March 03, 2007  
Anonymous Anonymous said...

http://www.adquity.com

Classifieds for our community. Buy, sell, trade, date, events... post anything. Adquity Classifieds.

http://www.adquity.com

1:00 AM, March 06, 2007  
Anonymous Anonymous said...

Hello !.
You re, I guess , perhaps very interested to know how one can collect a huge starting capital .
There is no need to invest much at first. You may start earning with as small sum of money as 20-100 dollars.

AimTrust is what you haven`t ever dreamt of such a chance to become rich
AimTrust represents an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

It is based in Panama with offices around the world.
Do you want to become an affluent person?
That`s your chance That`s what you desire!

I feel good, I started to take up income with the help of this company,
and I invite you to do the same. If it gets down to choose a proper companion who uses your money in a right way - that`s AimTrust!.
I take now up to 2G every day, and what I started with was a funny sum of 500 bucks!
It`s easy to get involved , just click this link http://zynuwoteni.exactpages.com/ladoraji.html
and lucky you`re! Let`s take our chance together to get rid of nastiness of the life

12:23 AM, December 03, 2009  
Anonymous Anonymous said...

Good day !.
You may , perhaps very interested to know how one can make real money .
There is no initial capital needed You may commense to receive yields with as small sum of money as 20-100 dollars.

AimTrust is what you need
AimTrust represents an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

It is based in Panama with offices everywhere: In USA, Canada, Cyprus.
Do you want to become an affluent person?
That`s your chance That`s what you really need!

I feel good, I began to get income with the help of this company,
and I invite you to do the same. If it gets down to choose a correct partner who uses your money in a right way - that`s AimTrust!.
I earn US$2,000 per day, and my first investment was 500 dollars only!
It`s easy to join , just click this link http://obirabox.servetown.com/cabybe.html
and go! Let`s take our chance together to get rid of nastiness of the life

12:56 PM, December 10, 2009  
Anonymous Anonymous said...

Good day !.
might , perhaps curious to know how one can collect a huge starting capital .
There is no need to invest much at first. You may start earning with as small sum of money as 20-100 dollars.

AimTrust is what you haven`t ever dreamt of such a chance to become rich
The company incorporates an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

Its head office is in Panama with affiliates around the world.
Do you want to become a happy investor?
That`s your choice That`s what you desire!

I feel good, I began to take up real money with the help of this company,
and I invite you to do the same. It`s all about how to choose a correct partner who uses your savings in a right way - that`s the AimTrust!.
I make 2G daily, and my first deposit was 1 grand only!
It`s easy to join , just click this link http://nibesysyda.builtfree.org/qigufa.html
and lucky you`re! Let`s take our chance together to become rich

11:07 PM, December 10, 2009  
Anonymous Anonymous said...

Hi there!
I would like to burn a theme at here. There is such a nicey, called HYIP, or High Yield Investment Program. It reminds of financial piramyde, but in rare cases one may happen to meet a company that really pays up to 2% daily not on invested money, but from real profits.

For quite a long time, I earn money with the help of these programs.
I don't have problems with money now, but there are heights that must be conquered . I get now up to 2G a day , and I started with funny 500 bucks.
Right now, I managed to catch a guaranteed variant to make a sharp rise . Visit my blog to get additional info.

http://theblogmoney.com

9:26 PM, January 11, 2010  
Anonymous Anonymous said...

Good day, sun shines!
There have been times of hardship when I didn't know about opportunities of getting high yields on investments. I was a dump and downright pessimistic person.
I have never imagined that there weren't any need in big starting capital.
Now, I feel good, I begin to get real money.
It gets down to select a proper partner who utilizes your money in a right way - that is incorporate it in real deals, parts and divides the income with me.

You can ask, if there are such firms? I'm obliged to answer the truth, YES, there are. Please get to know about one of them:
http://theblogmoney.com

1:54 AM, January 15, 2010  
Anonymous Anonymous said...

Hi!
You may probably be very interested to know how one can make real money on investments.
There is no initial capital needed.
You may begin to get income with a sum that usually is spent
for daily food, that's 20-100 dollars.
I have been participating in one project for several years,
and I'm ready to let you know my secrets at my blog.

Please visit my pages and send me private message to get the info.

P.S. I earn 1000-2000 per daily now.

http://theinvestblog.com [url=http://theinvestblog.com]Online Investment Blog[/url]

9:18 AM, February 01, 2010  
Anonymous Anonymous said...

Hi everybody!

We are not acquainted yet? It’s easy to fix,
my name is Nikolas.
Generally I’m a venturesome gambler. for a long time I’m keen on online-casino and poker.
Not long time ago I started my own blog, where I describe my virtual adventures.
Probably, it will be interesting for you to find out my particular opinion on famous gambling projects.
Please visit my blog. http://allbestcasino.com I’ll be interested on your opinion..

7:16 AM, March 12, 2010  
Anonymous Anonymous said...

Ηeya i am foг thе first time here. I cаmе acrosѕ this board and I find Іt truly useful & it helρed me out a lot.
I hoρe to giνе something back аnd hеlp others
lіκе you helpеd me.

Hеre іs my web blοg ... garden

7:34 AM, June 17, 2013  
Anonymous Anonymous said...

I enjoy what you guys tend to be up too. This type
of clevеr work and cοvеrаge!

Keеp up the еxcellent woгκѕ guys I’νe you guys to blogroll.



Αlso ѵisit my webpage - core training exercises

7:37 AM, June 17, 2013  

Post a Comment

<< Home