I subclassed ExpectedException attribute passing to super constructor AssertionException type.
Now if I attibute my test method with both my subclass and ExpectedException(AssertionException) I get runner and attribute order dependent behaviour:
- R# runner interpretes all attributes in sequence so a test method body that passes is toggled to failure by the first ExpectedException attribute then the failure is toggled back to pass by the next ExpectedException attribute.
- Nunit 2.5.3 gui-runner seems to interpret just the first one
for:
<Test()> <ObservedBehaviour("Code generator produces duplicates.")> <ExpectedException(GetType(AssertionException))> _
Public Sub ObservedBehaviourAfterChangeTest()
yielding:
Observed behaviour has been changed. Please balance the value of the change with compatibility breach costs.
Originally observed behaviour: Code generator produces duplicates.
NUnit.Framework.AssertionException was expected
while for
<Test()> <ExpectedException(GetType(AssertionException))> <ObservedBehaviour("Code generator produces duplicates.")> _
Public Sub ObservedBehaviourAfterChangeTest()
I subclassed ExpectedException attribute passing to super constructor AssertionException type.
Now if I attibute my test method with both my subclass and ExpectedExcepti on(AssertionExc eption) I get runner and attribute order dependent behaviour:
- R# runner interpretes all attributes in sequence so a test method body that passes is toggled to failure by the first ExpectedException attribute then the failure is toggled back to pass by the next ExpectedException attribute.
- Nunit 2.5.3 gui-runner seems to interpret just the first one
for:
<Test()> <ObservedBehavi our("Code generator produces duplicates.")> <ExpectedExcept ion(GetType( AssertionExcept ion))> _ urAfterChangeTe st()
Public Sub ObservedBehavio
yielding:
Observed behaviour has been changed. Please balance the value of the change with compatibility breach costs. Framework. AssertionExcept ion was expected
Originally observed behaviour: Code generator produces duplicates.
NUnit.
while for
<Test()> <ExpectedExcept ion(GetType( AssertionExcept ion))> <ObservedBehavi our("Code generator produces duplicates.")> _ urAfterChangeTe st()
Public Sub ObservedBehavio
returning:
NUnit. Framework. AssertionExcept ion was expected
The documentation deserves a clarification.