Unit test - Test your .NET code using NMOCK (1)

xiaoxiao2021-03-06  42

The recent work is doing unit testing, occasionally I saw this called NMOCK, I didn't find some documents about it, I found some information on MSDN, try to do translation (two I didn't touch more than a year, and there will definitely have some indispensable places). Original address: http://msdn.microsoft.com/msdnmag/issues/04/10/nmock/default.aspx

This article discusses: ● The role of analog objects ● How to understand and use NMOCK ● An overview of a shopping example ● Test scheme design guidelines You have considered the unit testing of a project, but due to the module you want to test Either there are too many dependencies, or the unit itself is difficult to independent, so that the test is more like a comprehensive test and dispelled your idea? Or maybe create an external dependency is unrealistic or you can't find the system variable or value you expect.

Analog objects can help you overcome these obstacles and have an additional benefit: forced to use good design habits. In this article, I will describe how to use a common dynamic analog object library called NMOCK and will provide some design options that have special purposes in my work.

NMOCK is a good tool, but unfortunately there is no documentation or example yet, so it is hard to accept what it can do, even what is the purpose. I will tell the purpose and use of NMOCK by showing how to write unit tests to a commercial logic library depending on the data access layer.

转载请注明原文地址:https://www.9cbs.com/read-79452.html

New Post(0)