Unit Testing

Yet another important feature of functional programming!

UT

It is very intuitive, so I have a simple quiz …

Why does the following fails

 

using System;
using NUnit.Framework;

namespace AssociateFeeCentral
{
	[TestFixture]
	public class CentralTest
	{
		[Test]
		public void Test01TempTable()
		{
			try {
				Assert.Pass();
			} catch (Exception exc) {
				Assert.Fail( "error: " + exc.Message);
			}
		}
	}
}

 

Fails
while this other passes?

using System;
using NUnit.Framework;

namespace AssociateFeeCentral
{
	[TestFixture]
	public class CentralTest
	{
		[Test]
		public void Test01TempTable()
		{
			try {

			} catch (Exception exc) {
				Assert.Fail("error: " + exc.Message);
			}
			Assert.Pass();
		}
	}
}

Passes

Please, write your answer as a comment here! Thank you.

Advertisements

2 thoughts on “Unit Testing

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s