The attributes of a good unit test

A unit test is a piece of code written to test another code. It is sometimes referred to as the lowest-level test because it is used to test code at the lowest level of an application. The unit test calls the method or class under test to validate and assert assumptions about the logic, function, and behavior of the code being tested.

The main purpose of unit testing is to validate a unit of code under test, to ascertain that the piece of code does what it is designed to do and not otherwise. Through unit testing, the correctness of a unit of code can be proven, this can be achieved only if the unit test is written well. While unit testing will prove the correctness and help to discover bugs in code, code ...

Get C# and .NET Core Test Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.