How to unit test manage a library?

I program a simple control library that checks user input from text and formats the input. I want to do a unit test. How can i do this?

+3
source share
1 answer

I would look at this SO question . There are good answers there. The Marek Grzenkowicz CodeProject article contains some information about the TextBox unit testing that he developed.


Edit: Testing the user interface can be a problem, and I try to pull as much as possible out of the user interface and translate it into a more tested class. Obviously, you want your unit tests to run without any user interaction, so if your class method accepts an input string and formats it, you can write a test (using NUnit, MS Test, etc.) For ensure input and check the actual result for expected results.

NUnit , , . Visual Studio Test- > New Test.... , VS 2008 Professional , .

, SO NUnit. .

+4

Source: https://habr.com/ru/post/1741474/


All Articles