WebShaCom1.gif

Introduction

This tutorial is an introduction to Test Driven Development (TDD) in Visual Studio 2010 (VS2010) with C# 4 and ASP.NET 4. This will focus on as using the tool and coding as much as possible and not a great deal of words so enjoy the ride.

We are covering some material that was presented in my earlier tutorial http://domscode.com/2010/05/21/net-tutorial-c4-0-and-test-driven-development-cannonattack/ so if you haven't used VS2010 and TDD have a look.

The WebSharpCompiler Requirements/Specs:

The following is a combination of requirements and specifications that will give us an idea of what we are trying to build:

  1. ASP.NET Application;
  2. Textbox will contain code to compile
  3. Empty Textbox is not allowed to be compiled
  4. A Compile button will trigger compile
  5. A Clear button will clear the textbox
  6. When [Compile] is clicked, text from textbox will be compiled using a C# compiler and messages from compile displayed in a Listbox

Iteration 1

We are going to setup the project and build our first test.

Iteration 1 - Creating the Solution and our first test

Just remember you can use some cool VS2010 features to make these changes including:

Iteration 2

3rd Iteration

The third iteration of work is to complete the web site and given that the UI is very simple this won't take very long.

Or

WebShaCom12.gif

In Conclusion

So there we have our C# compiler. Source code link is below and feel free to drop me a line here if you have any thoughts/advice on this.

All the best

Dom.

References

http://msdn.microsoft.com/en-us/library/system.codedom.compiler.codedomprovider.aspx