AssertMessage Mutator

Automatically generates a pretty formated message for assertions by extracting the condition code from the sources and embedding it into the error message.
  • Defined in: CciSharp.AssertMessage.dll

Example

  • original code
Assert.IsTrue(x != y);
  • rewritten code
Assert.IsTrue(x != y, "x != y where x = {0}, y = {1}", x, y);

Requirements:

  • only simple assert methods are supported, i.e. Assert.True or Assert.False.
  • the tool detects any reference to a local, parameter or field in the condition and embeds it into the message. It does not deal with side effects that occur in the condition evaluation.
  • supports assertion types from the BCL (Debug.Assert, NUnit, MbUnit, xUnit.net and Pex.
    • when no overload supporting a format string and arguments is available, the rewritter simply uses String.Format.

Last edited Dec 26, 2009 at 11:22 PM by pelikhan, version 5

Comments

No comments yet.