nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #02307
[Bug 901629] [NEW] TestCaseData Exception
Public bug reported:
The following is possible: new TestCaseData
(...).Throws(typeof(MyException))
But what I want to do is to spezify other additional conditions to the exception.
This might be a Assert on the message text or a user defined property of the exception, something like an error number.
I don't know about the right way, but perhaps it is possible to add a
additional parameter to throws with a class, that is derived from an
interface like this (and the method is called, if the exception has the
right type:
interface IExceptionCompare
{
bool Match(Exception e);
}
Hmm, perhaps this could be also used instead of the type, so the function also test if the right type.
Throws (IExceptionCompare comparer){ ... }
internal the current implementation could be adapted to use this
interface also.
** Affects: nunit-3.0
Importance: Undecided
Status: New
** Tags: feature
--
You received this bug notification because you are a member of NUnit
Core Developers, which is the registrant for NUnit Framework.
https://bugs.launchpad.net/bugs/901629
Title:
TestCaseData Exception
Status in NUnit Test Framework:
New
Bug description:
The following is possible: new TestCaseData
(...).Throws(typeof(MyException))
But what I want to do is to spezify other additional conditions to the exception.
This might be a Assert on the message text or a user defined property of the exception, something like an error number.
I don't know about the right way, but perhaps it is possible to add a
additional parameter to throws with a class, that is derived from an
interface like this (and the method is called, if the exception has
the right type:
interface IExceptionCompare
{
bool Match(Exception e);
}
Hmm, perhaps this could be also used instead of the type, so the function also test if the right type.
Throws (IExceptionCompare comparer){ ... }
internal the current implementation could be adapted to use this
interface also.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nunit-3.0/+bug/901629/+subscriptions
Follow ups
References