Testing with Mock Objects and C#
Testing with Mock Objects and C#
Submitted by webmaster@testdriven.com (Links) on Thu, 02/09/2004 - 15:35.Mock objects present an alternative way to make tests for our classes, simplifying the testing process and making test-specific behaviour of our classes possible, when this behaviour relies in other complex classes or subsystems. When we are making unit tests and our class uses other complex classes or subsystems, we could find the following problems:
a) The preparation for the test is hard because of the environment required by the collaborative classes (or subsystems) is complex [.. ]
b) We cant use the subsystem classes because of they had not been developed yet
c) The behaviour that we are trying to test depends on a remotely situation happened in the subsystem
In all of these situations, we can consider substitute the subsystem with a "mock object" that simulate the expected behaviour required to check our system, we get a really big independency from the subsystem enabling us make our tests more simple, more effective and quicker.
Author: Raúl Alarcón García-Cuevas
Posted: 31 August 2004
a) The preparation for the test is hard because of the environment required by the collaborative classes (or subsystems) is complex [.. ]
b) We cant use the subsystem classes because of they had not been developed yet
c) The behaviour that we are trying to test depends on a remotely situation happened in the subsystem
In all of these situations, we can consider substitute the subsystem with a "mock object" that simulate the expected behaviour required to check our system, we get a really big independency from the subsystem enabling us make our tests more simple, more effective and quicker.
Author: Raúl Alarcón García-Cuevas
Posted: 31 August 2004
