Visual Studio Unit Testing Extensions v1.1.0.0
I just released version 1.1.0.0 of these Unit Testing Extensions on CodePlex today. The original post that talks about the project can be found here.
This release contains additional assertions on DateTime, ICollection<T>, and String. This release is also targeted to the .NET 4 Framework.
Here are some examples of the new assertions in action:
[TestMethod]
public void Test()
{
DateTime foo = DateTime.Now;
foo.ShouldBeBefore(Datetime.MaxValue);
}
[TestMethod]
public void Test()
{
DateTime foo = DateTime.Now;
foo.ShouldBeAfterOrSameAs(Datetime.MinValue);
}
[TestMethod]
public void Test()
{
List<int> foo = new List<int>() { 1, 2, 3 };
foo.ShouldNotBeEmpty();
}
[TestMethod]
public void Test()
{
List<int> foo = new List<int>() { 1, 2, 3 };
foo.ShouldContain(1);
}
[TestMethod]
public void Test()
{
List<int> foo = new List<int>() { 1, 2, 3 };
foo.ShouldHaveCountOf(3);
}
[TestMethod]
public void Test()
{
string foo = "foobar";
foo.ShouldContain("foo");
}
[TestMethod]
public void Test()
{
string foo = "foobar";
foo.ShouldNotContainIgnoringCase("TEST");
}
Comments
Anonymous
December 05, 2010
The comment has been removedAnonymous
December 06, 2010
Have you talked to the other .NET fluent assertion library developers? I've used fluentassertions.codeplex.com before, and am aware of code.google.com/.../fluent-assert as well - there could be a lot of common ground between you guys.Anonymous
February 03, 2011
Is there any way I can set the message when the Assert is successful? Thanks in advance, Krishna Chaduvula