NUnit is one of the most widely used test frameworks on the. NET platform, this article describes the use of NUnit by example, and provides several suggestions and tips for preparing unit tests for beginners ' reference.
Before continuing, let's take a look at a very simple test case (TestCase):
1 [Test]
2 public void Additiontest ()
3 {
4 int expectedresult = 2;
6 assert.areequal (exptectedresult, 1 + 1);
7}
You would say this testcase is too stupid! This is also a lot of nunit documents have been criticized, but my understanding is not so, Xunit is the simple framework for the development of UT, keep it simplicity and stupid, any use of complex testcase to introduce nunit usage is a misleading, UT's complexity lies in how it is applied and implemented in actual projects, rather than hovering over how to use NUnit.
Main content:
1, the basic use of NUnit
2. Organization of test Cases
3, NUnit assertion (Assert)
4. Introduction of common unit testing tools