Boolean Assertions

These assertion extension methods can be applied to only boolean object types.

ShouldBeFalse

Asserts that this boolean value is false.

Usage

public static bool ShouldBeFalse(this bool source)
public static bool ShouldBeFalse(this bool source, string message)
public static bool ShouldBeFalse(this bool source, string message, params object[] parameters)
public static bool? ShouldBeFalse(this bool? source)
public static bool? ShouldBeFalse(this bool? source, string message)
public static bool? ShouldBeFalse(this bool? source, string message, params object[] parameters)

Example

[TestMethod]
public void Test()
{
   bool foo = false;
   foo.ShouldBeFalse();

   bool? bar= false;
   bar.ShouldBeFalse();
}
Supported Releases: All

ShouldBeTrue

Asserts that this boolean value is true.

Usage

public static bool ShouldBeTrue(this bool source)
public static bool ShouldBeTrue(this bool source, string message)
public static bool ShouldBeTrue(this bool source, string message, params object[] parameters)
public static bool? ShouldBeTrue(this bool? source)
public static bool? ShouldBeTrue(this bool? source, string message)
public static bool? ShouldBeTrue(this bool? source, string message, params object[] parameters)

Example

[TestMethod]
public void Test()
{
   bool foo = true;
   foo.ShouldBeTrue();

   bool? bar= true;
   bar.ShouldBeTrue();
}
Supported Releases: All

Last edited Dec 9, 2010 at 2:52 PM by jeremiahclark, version 2

Comments

No comments yet.