Test driven development
How To Configure ASP.NET Unit Tests in Visual Studio 2010 - SkoNet. (Microsoft .NET,Microsoft ASP.NET,Microsoft Visual Studio) by Jason Skowronek on 02/03/2011 This article demonstrates how to setup a basic unit test project to take care of code coverage of a standard ASP.NET website.
This article assumes you have created an ASP.NET Web Application project (not ASP.NET Website). Setup a Unit Test Project Open your solution in Visual Studio 2010Click Test | New TestSelect Basic Unit Test (or any of the others)Name your test classAdd to or create a new test project (preferably ProjectName.Tests) Moq - The simplest mocking library for .NET and Silverlight. Mocks Aren't Stubs.
The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing.
Most language environments now have frameworks that make it easy to create mock objects. What's often not realized, however, is that mock objects are but one form of special case test object, one that enables a different style of testing. In this article I'll explain how mock objects work, how they encourage testing based on behavior verification, and how the community around them uses them to develop a different style of testing. I first came across the term "mock object" a few years ago in the XP community. Since then I've run into mock objects more and more. State Testing vs Interaction Testing.
Highly recommended reading: Fowler’s article Mocks aren’t Stubs.
It’s a very clear characterization of the types of so-called Test Doubles (mocks, fakes, stubs, etc.) you can use to aid your unit testing needs, but also of the kinds of TDD you can do: classic (or state) TDD and mockist (or interaction) TDD. I got the feeling that the article seemed a bit biased towards mockist TDD, only to see in the “So should I be a classicist or a mockist?” Section that Fowler himself is a classic TDDer ). Maybe it’s because mockist TDD is a newer approach to TDD and therefore required a more extensive explanation. Using ApprovalTests in .Net 20 Asp.Mvc Views. Visual Studio 2010: Test Driven Development. Description Visual Studio 2010 brings with it several enhancements to help cut development friction and enable the developer to focus on the task at hand: writing high-quality code.
In the following exercises we'll highlight several of the new features that the TDD developer can use to enhance his/her development cadence. Visual Studio helps your cadence by cutting the number of keystrokes to accomplish frequently performed tasks, speeds navigation through your solution, and enables you to use test frameworks other than MSTest. Overview. Fit: Framework for Integrated Test. Mocking The File System to Improve Testability « Milan Nankov’s Blog. Recently I started writing a simple application that would help me organize my music files by automatically renaming them using their tags and moving them to their designated folders.
As expected the program will rely on the file system classes that the .Net Framework provides. Naturally, I wanted to cover the I/O logic with tests so that I am confident that when the software is used it will not do damage to my files and will behave according to my requirements.