NET Unit Test Literacy

Source: Internet
Author: User

Online search and sorting out some of the concept of unit testing

Concept: Unit test is the smallest unit of software testing. Used to check if one or several of the related methods behave correctly.

1.3A Principle of unit testing

Arang: Arranging, initializing

Action: operation, execution

Assert: Assertion, result

2. Common assertion Methods

Areequal-asserts that two values are equal
Arenotequal-asserts that two values are not equal
Arenotsame-asserts that two objects are different objects
Aresame-asserts that two objects are the same object
fail-assertion that a test failed
Inconclusive-asserts that the result of a test is indeterminate. Visual Studio includes this assertion in its auto-generated methods, asking you to implement it yourself
Isfalse-asserts that a given conditional expression returns a value of False
Isinstanceoftype-asserts that a given object is an instance of a specified type
Isnotinstanceoftype-asserts that a given object is not an instance of a specified type
Isnotnull-asserts that an object is not a null value
Isnull-asserts that an object is a null value
Istrue-asserts that a given conditional expression returns a value of True

3. Common frame mocks for unit tests

Build unit tests by using some mock object frames.

moq–http://code.google.com/p/moq/.
Rhino mocks–http://ayende.com/projects/rhino-mocks.aspx.
Typemock isolator–http://www.typemock.com

NET Unit Test Literacy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.