Test Driven Development Built Name Generator Part 3(adronbhall.com)
submitted by
adron(835) 3 years, 3 months ago
Now it is time finally for the random name generation. I’ve gotten everything into place, so it’s just a matter of grabbing the names and randomizing among them. Just as a check, after Part 2 was finished I had a total of 98,572 rows of data, or simply 98,572 names.
Many times I would not write actual unit tests against the database as it breaks isolation. This time though, I'm making an exception. First I added a reference to Generator.Core, System.Data, and System.Data.Entity. I then created a new unit test class called DatabaseTests and added the following test to get things rolling. Keep in mind, since these tests break isolation, I don't write them in the red light green light idea of TDD. My assumption is that they only prove the database is setup, running, the connection string is correct, and other minor configuration based and server based components. In addition, yes, these are somewhat silly tests, such as the RetrieveFirstName() test has a bit of redundancy to it, but the point is to have an automated test to assure that the data has been moved into the database and is returning appropriately.
|category: Unit Testing
|Views: 4
tags:
Testing another
Everyones tags:
Your Tags: