Write and validate .NET specifications in BDD style.This framework can be used along with any other unit testing, mocking frameworks. Main purpose of this framework is to allow writing unit tests in
... [More]
BDD style (similar to RSpec)
Simple usage example:
using System;
using NUnit.Framework;
namespace Demo.Spec
{
public class CreditCardTest : ArtSpec.Spec
{
/* note: override this method to define specification */
protected override void Specify()
{
Console.WriteLine(@"CreditCardTest demonstrates using NUnit framework");
It("should have a valid month", () =>
{
/* note: defines expectation of an exception */
Error(delegate { new CreditCard {Month = 0}; });
Error(delegate { new CreditCard {Month = 13}; });
Error(delegate { new CreditCard {Month = -1}; });
new CreditCard {Month = 1};
new CreditCard {Month = 12};
});
It("should have a valid year", () =>
{
Error(delegate { new CreditCard {Year = -1}; });
/* note: other unit testing frameworks can be used */
Assert.AreEqual(2009, (new CreditCard {Year = 2009}).Year);
});
It("should have at least two words in the name", () =>
{
Error(()=> new CreditCard {Name = "Sam"});
Assert.AreEqual("Sam Smith", (new CreditCard {Name = "Sam Smith"}).Name);
Assert.AreEqual("Sam Smith Third", (new CreditCard { Name = "Sam Smith Third" }).Name);
});
}
}
}This and other samples are included in the release
This approach will be frozen due to a better approach demonstrated by MSpec, good job guys! It is highly recommended.
ArtSpec has been tried to provide BDD for XF.Server component (http://www.kodart.com) which provides high performance for client-server applications using .NET [Less]