The Full Stack, Part 3: Building a Repository using TDD
- Posted: Nov 09, 2010 at 1:18 PM
- 53,282 Views
- 9 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
In this episode, Jon and Jesse set up unit testing for their MVC 3 application, discuss uint testing and test driven development, and build out a repository.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
That was quick, you just seemed to be getting started. I like the explanation on how to get past the mental block of where to start with the tests.
One thing I'm curious about, is the purpose of the show. It is a how-to of selected "pancakes" in the stack or your approach in creating an application from scratch?
Either way, more please, still hungry.
Much better epsoide, short and too the point, would be good to see you guys lay down the basic tenants of the story for the structure of the site, which i guess your not to sure of yet, what parts of the stack you want to use, how you plan to get there, seeing how they are implemented as well.
Cheers
@Mazric: These are great suggestions. We've been letting the design evolve, to some degree, but things are firming up and we'll be sure to provide more of a road map in coming episodes.
Very interesting episode; I've been trying to get off the ground with TDD and this was quite helpful. I am a little confused though. First, is Exists() really a method for the repository? Meaning, it seemed like it was created for the sake of testing. Forgive me if that is naive, but I'm still new to this.
Also, I understand that creating the interface for your repository is necessary for testing, but it seems to contradict something that Jesse said at the beginning. If TDD is meant to drive your design, and you only implement what you need and not what you *think* you'll need, doesn't the creation of an interface, at this point, a contradiction? You've written something only so you could implement your tests without knowing if you'll have an actually need for that interface in your code later. So far, we only know that the app will need a person repository so you've got an interface implemented by only one class outside of your tests. It seems like the tests have driven you to create something you don't actually need...except for testing.
Oh. It's too slowly.
Really enjoying seeing so many different aspects of a start->finish project, already including pair programming, TDD, Repository pattern. I hope you plan to continue introducing a new pattern/practice/etc each episode. I have some understanding of each, but it's nice to see the glue or process of putting them all to use in a single project.
Are you planning to release any code snippets or source? There are times when I am not fully aware of your chosen implementation details, such as where you are putting your Repository Interface in relation to namespace and project - Main vs. Test project in the solution.
I would really like to be able to subscribe to this series in iTunes I hope you have the time to make that possible, been really enjoying them but would like to have them on the go with me.
First of all I would like to say that this is good stuff. You're keeping it simple and still showing good best practices.
I think you might have one error in your 3rd episode. The test method for the update of the fake repository doesn't really test the update method. Since you're getting the instance of the object the update take when you set the new name on the person instance and not when you call the update method. But guess you'll find that when you're testing against the reall repository since the get will access the db and not the dictionary.
Keep up the good work!
Starting TDD always reminds me of that Mitch Hedberg joke: "People who smoke cigarettes, they say 'Man, you don't know how hard it is to quit smoking.' Yes, I do -- it's as hard as it is to start flossing."
Remove this comment
Remove this thread
close