Objectives

In this Hands-On Lab, you will learn how to:

  • Test simple controller actions
  • Test actions that interact with a database
  • Test actions that use the user’s session

System Requirements

You must have the following items to complete this lab:

  • ASP.NET and ASP.NET MVC 3
  • Visual Studio 2010 Professional or superior
  • SQL Server Database (Express edition or above)
Note:
You can install the previous system requirements by using the Web Platform Installer 3.0: https://go.microsoft.com/fwlink/?LinkID=194638.

Setup

For convenience, much of the code used in this hands-on lab is available as Visual Studio code snippets. To check the prerequisites of the lab and install the code snippets:

  1. Open a Windows Explorer window and browse to the lab’s Source\Setup folder.
  2. Double-click the Dependencies.dep file in this folder to launch the Dependency Checker tool and install any missing prerequisites and the Visual Studio code snippets.
  3. If the User Account Control dialog is shown, confirm the action to proceed.
Note:
 This process may require elevation. The .dep extension is associated with the Dependency Checker tool during its installation. For additional information about the setup procedure and how to install the Dependency Checker tool, refer to the Setup.docx document in the Assets folder of the training kit.

Exercises

This Hands-On Lab is comprised by the following exercises:

  1. Exercise 1: Testing simple controller actions
  2. Exercise 2: Testing CRUD actions
  3. Exercise 3: Testing cart actions

Estimated time to complete this lab: 35 minutes.

Note:
Each exercise is accompanied by an End folder containing the resulting solution you should obtain after completing the exercises. You can use this solution as a guide if you need additional help working through the exercises.

Next Step

Exercise 1: Testing simple controller actions