In this series of blog posts I am going to go through step by step how to create a working application in C# by using the Test Driven Development process.
The application that I am going to build is a 1 page site that allows users to enter their favourite artist and track title then it will suggest other music they may like. The reason I have choose this is its relatively simple but at the same time covers a lot of the key TDD areas.
- ASP.Net MVC 3
- Entity Framework 4
- LastFM Application Key for their API.
- SQL Server 2005+ (Probably will work on 2000)
What we are going to create is a 1 page Asp.Net MVC site with a search form for finding similar tracks, a results area to show the similar tracks and another area to list recent searches. I’ll be using the Last FM REST API to find the similar music (specifically the track.getSimilar call), to make the REST calls we’re going to use RestSharp a .Net library for accessing REST services. I’m going to use the built in Visual Studio unit test framework, if you don't have this in your version you’ll be able to use nUnit or any other unit testing framework with minimal changes.
Configuring The Solution
In Visual Studio take the following steps
- File New, Other Project Types, Visual Studio Solutions
- Create a blank solution called “TDDMusicMatch”
- Add a new ASP.Net MVC 3 Web Application called “TDDMusicMatch.Web” with these options
- Add a new test project called “TDDMusicMatch.Tests”
- Delete UnitTest1.cs from the test project
The solution should then look like this
In part 2 we will go through creating our first unit tests…