2009/01/28

Generic syntax for the MbUnit reflective assertions.

The MbUnit v3 assertions related to type checking have been extended with a generic syntax counterpart. The four assertion methods:
  • Assert.IsInstanceOfType(Type expectedType, object actualObject);
  • Assert.IsNotInstanceOfType(Type unexpectedType, object actualObject);
  • Assert.IsAssignableFrom(Type expectedType, object actualObject);
  • Assert.IsNotAssignableFrom(Type unexpectedType, object actualObject);
And their overloads with a custom message as well, do now exist with the following syntax:
  • Assert.IsInstanceOfType<TExpected>(object actualObject);
  • Assert.IsNotInstanceOfType<TUnexpected>(object actualObject);
  • Assert.IsAssignableFrom<TExpected>(object actualObject);
  • Assert.IsNotAssignableFrom<TUnexpected>(object actualObject);
Those new methods are available in Gallio v3.0.6.649 and later.

No comments: