[Mono-devel-list] Patch to use ExpectedException in Test XmlTextWriterTests

Martin Willemoes Hansen mwh at sysrq.dk
Wed Jul 2 18:49:02 EDT 2003

> I see that Martin has reverted his patch back to the original version,
> with try/catch blocks.

Yes most of it .. some where okay, but the most where not ;)

> I really like the new ExpectedExceptionAttribute.
Yes its very nice.

> Is it important that the two tests pass sequentially? If not, what about
> something like this?
> [Test] [ExpectedException (typeof (ArgumentException)]
> public void CommentInvalid1 ()
> {
> 	xtw.WriteComment ("foo-");
> }
> [Test] [ExpectedException (typeof (ArgumentException)]
> public void CommentInvalid2 ()
> {
> 	xtw.WriteComment ("foo-->bar");
> }
> If the two tests do need to be ran sequentially, I wonder if it's
> possible to call another [Test] method within an existing [Test]
> method... that might be one solution.

Umh .. You could do that but the tests will be ran twice I think ..
First as individual tests then as part of the combined ..
Anyways a 
try { foobar() }; Fail(); catch {ExpectedException}; is not that bad.

Martin Willemoes Hansen

E-Mail	mwh at sysrq.dk	Website	mwh.sysrq.dk
IRC     MWH, freenode.net

More information about the Mono-devel-list mailing list