I have always known the benefits of unit testing. Unfortunately, I am also a layman so lazy to write test code on the console. recently I am tossing my own idea to make a small software and design a lot of algorithm data processing. The result is very important and will affect the final judgment. So I have to test all the algorithms. in this case, Nunit has to be included. I have seen some Nunit usage and videos before, which are actually very simple. The results were as expected. The test detected small errors in many algorithms. It also made me feel the power of this gadget. at the same time, I also have a small experience, that is, sometimes testing wrong algorithms, it is not easy to find the wrong place, nor can I perform breakpoint debugging and start to commit errors. Later, we pulled this method directly to the main () function to run it. We can see errors at the breakpoint. Of course, you must set the project type as a console application.
There is another tips for testing data. In a few days, I will write a more complete article. It is how to write test data in a text file and read it in the test program. This is very convenient, because there is too much data, it is very troublesome to define in the program.