“UNIT TESTING is a level of software testing where individual units/ components of a software are tested. The purpose is to validate that each unit of the software performs as designed. A unit is the smallest testable part of any software. It usually has one or a few inputs and usually a single output.”
Effective unit tests need Clean Code with a Testable design. Your tests need to be Context-aware, that is to say unit tests in project a may not hold the same value of tests in project b.
Unit of Work
Everything that happens from invoking a public method to it returning the results after it’s finished; it’s the work done along the path you see the debugger take through your code.
Code that invokes a unit of work within the confines of a project layer while faking external dependencies and validates an assumption about one specific scenario.
Code that invokes a unit of work that crosses project boundaries, uses actual external dependencies, and/or validates many different aspects about the code under test.
A substitute for a dependency in the code under test that allows the code to compile and the dependency to return data as specified by the test but importantly cannot itself directly make a test fail.
A substitute for a dependency in the code under test that knows how many times each of its methods were called an in what order so that it can validate an assumption about how the dependency was used and therefore make a test fail.
A generic term for a replacement of a real dependency with something the test specifies, which includes both stubs and mocks.