Quick Start Guide

From asMock

Jump to: navigation, search

This guide will show you what asMock can do and how you can use it.

It starts off simply and gets more advanced, so feel free to read only what you feel comfortable with. Once you've had some experience with mocking, you may want to return to this guide and read up on the advanced features.

Overview

Mocking is the process of creating a fake (or "mock") version of an object and manipulating how it will respond to each of it's methods (recording). The mocked object can then be supplied to the component being tested (replaying). Finally, you can assert that any expected interactions (method calls, etc) with the mock actually took place (verifying).

Testing is all about controlling the inputs of a method and verifying it's output. Without mocking, though, only some of the method's inputs can be controlled: it's arguments, and any properties of it's parent class. Mocking allows the other inputs (ie. the class's dependencies) to be controlled, thus allowing for much more focused testing.

Quick Start Table Of Contents

Personal tools