.NET Code Documentation And Testing: They Are There, Why Not Use It?

Remember the “///”?  They are the C# XML documentation comments and they are pretty useful when you are building your APIs and frameworks so other developers who use your code can at least see some useful information on your classes and methods through the intellisense provided by the Visual Studio IDE.

Take the following sample code below.  I have a constructor and a method decorated with XML comments.

And on the code where they are used, when I hover over them I will see my comments displayed.



So how about code testing?  .NET or more accurately Visual Studio comes with the Microsoft unit test framework.  It’s so easy to add one to your new project or existing project.  Once you have the stubs created for you, you can start coding your tests.

Below is a sample unit testing code I created.

So every time you make changes to your code, and I say you will always need to change or refactor code, running these tests will make sure you didn’t break anything.  So it is a pretty useful tool and I see the benefit in this.  And it’s so nice to see so many green check marks on your Test Explorer.


For more information, check out these links:


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s