Sharp Tests Extensions 0.3.0

Rating: No reviews yet
Downloads: 114
Released: Sep 22, 2009
Updated: Sep 22, 2009 by fabiomaulo
Dev status: Alpha Help Icon

Recommended Download

Application SharpTestsEx
application, 138K, uploaded Sep 22, 2009 - 114 downloads

Release Notes

Project Description
SharpTestsEx (Sharp Tests Extensions) is a set of extensible extensions. The main target is write short assertions where the Visual Studio IDE intellisense is your guide. #TestsEx can be used with NUnit, MsTests, xUnit, MbUnit... even in Silverlight.

Have a look to the Syntax Overview.

BREAKING CHANGES

#TestsEx extensions are now available only if you add the using clause
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
...

using SharpTestsEx;

namespace Roadtrip.Admin.Tests.Controllers
{
	[TestClass]
	public class HomeControllerTest
	{
		[TestMethod]
		public void Index()
		{
			var controller = new HomeController();
			var result = controller.Index() as ViewResult;
			ViewDataDictionary viewData = result.ViewData;

			((string) viewData["Message"]).Should().Be.EqualTo("WELCOME!!");
		}
	}
}
This change was needed because, starting from this release, #TestsEx does support various unit tests framework as MsTests, NUnit and xUnit.

New Feature

Lambda/LINQ based Assertions

More than an experiment this is a preview of a new very powerful way to write assertions.
For developers an example will be more than enough... pure .NET language and LINQ assertions
1.Satisfy(x => x == 1 || x == 2);
1.Satisfy(x => x > 0);
1.Satisfy(x => 2 > x);

const int y = 2;
const int z = 4;
4.Satisfy(x => x == y * y);
2.Satisfy(x => x == z / y);

"1".Satisfy(x => x == 1.ToString());

var y = 2;
new[] { 1, 2 }.Satisfy(x => x.Contains(y));
var y = new[] { 1, 2 };
var z = new[] { 2, 1 };
1.Satisfy(x => x == y[0] && x == z[1]);

new[] {1, 2}.Satisfy(x => x.SequenceEqual(new[] {1, 2}));
We are working on this new feature to make it even more powerful.

Reviews for this release

No reviews yet for this release.