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


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


  • 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, and Pex.
    • when no overload supporting a format string and arguments is available, the rewritter simply uses String.Format.

Last edited Dec 27, 2009 at 12:22 AM by pelikhan, version 5


No comments yet.