[Mono-devel-list] System.Drawing.Pens test patch

Andrew Skiba andrews at mainsoft.com
Sun Jul 31 08:56:53 EDT 2005


In many tests in System.Drawing there is a strange construct like:

try {
	Do.Something ();
	Fail ("This should throw ArgumentException");
catch (Exception e) {
	Assert ("MSG", e is ArgumentException);

Problem with this approach is that catch will take care of all
exceptions and then rethrow nunit assertion exception via Assert (...).
The source and the call stack of original exception will be lost. So I
changed it to:

catch (ArgumentException) {
	Assert ("MSG", true);

In this way, if e is not argument exception, its contents will be seen
in TestResults.xml, together with the whole call stack.

I'm not sure if there is any use of Assert ("MSG", true), may be it can
be omitted?

While it would be best to fix all such places, I changed only those I
needed right now, and the rest can be done later.

Thank you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Catch.patch
Type: application/octet-stream
Size: 46027 bytes
Desc: Catch.patch
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050731/a0c3b34e/attachment.obj 

More information about the Mono-devel-list mailing list