Console Unit Testing - ploeh blog. In many scenarios, console applications are very useful, but if you have a console application of intermediate complexity, you should obviously unit test it like all the other code you write - right? If you have a console application as an administration utility for a complex piece of software you are developing, the console application should obviously just be a thin UI layer that delegates all the work to a testable library that may already exist, but even so, you may have some complex UI interaction that may benefit from testing. For once, consider the task of parsing the command line arguments. This may involve some semi-complex logic where unit testing may save you a lot of troubleshooting. You may also want to have a regression test suite to validate that console output is as expected. Let's say that I want to unit test this method: public void DoWork() Console.WriteLine("Ploeh"); In a unit test, I'd like to test that the correct text is being written to the console.
[TestMethod] Advanced Unit Testing, Part I - Overview. Oh dear God, anybody who votes [for unit-testing] has major problems. I hate the @#$% things. And the "Write tests first, code later" paradigm eludes me. I mean, come on, unit testing is not the end-all, be-all people! I don't care how sophisticated your tests are, a "pass/fail" grade is not sufficient to make sure you're ready for production. - David Stone, on the "do you like design or unit testing better" survey. Contents Preface This is a meandering article on the issues of unit testing and the Extreme Programming (XP) process.
The four articles in this series are: Introduction As brash as the title sounds, I personally feel that the concept of unit testing has a long way to go. On the other hand, I'm realizing that unit testing has its place in the code-writing process. On the other hand, I also think unit testing is too simplistic. There is also the idea that if your unit tests pass, then your code is ready for production (or, at least, acceptance testing). What Is A Unit Test? SetUp. Microsoft All-In-One Code Framework - a centralized code sample library. NUnitit - a Visual Studio Addin for NUnit. Windows Presentation Foundation (WPF) - Download: WPF Toolkit - February 2010 Release. Dynamic Data Display. Code Sample. Galerie d’exemples MSDN. SDKs.