You can indeed specify the exception per row but you need to do it like
this:
 
<Row(0, 2, 3, ExpectedException=GetType(NotEqualAssertionException))>
 
Notice that the expected exception is a named property of the Row
attribute in this case.  The way you wrote it originally was applying
the ExpectedException to the whole test.
 
Jeff.

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED]
On Behalf Of Robert Porter
Sent: Friday, September 21, 2007 12:54 PM
To: [email protected]
Subject: MbUnit VB.NET RowTest with and without ExpectedExceptions
Question


have a test fixture that I am trying to get working in VB.NET so I 
can understand how RowTest works. It looks like this: 


    <RowTest()> _ 
    <Row(1, 2, 3)> _ 
    <Row(2, 2, 4)> _ 
    <Row(0, 2, 3), 
ExpectedException(GetType(MbUnit.Core.Exceptions.NotEqualAssertionExcept
ion))> 
_ 
    Public Sub MyRowTest(ByVal x1 As Integer, ByVal x2 As Integer, 
ByVal exp As Integer) 
        Dim test As Integer = x1 + x2 
        Assert.AreEqual(exp, test) 


    End Sub 


When I run the test I get the exact opposite of what I expected. The 
two rows without an ExpectedException Fail and the one with the 
expected exception suceeds. I thought you could specify 
ExpectedExceptions or not per row? 


Below is the output from Visual Studio 2005 


Found 3 tests 
[failure] myTestClass.MyRowTest(2,2,4) 
TestCase 'myTestClass.MyRowTest(2,2,4)' 
failed: Exception of type 
'MbUnit.Core.Exceptions.ExceptionNotThrownException' was thrown. 
Expected exception of type Exception of type 
' MbUnit.Core.Exceptions.ExceptionNotThrownException' was thrown., did 
not get it. 
        MbUnit.Core.Exceptions.ExceptionNotThrownException 
        Message: Exception of type 
'MbUnit.Core.Exceptions.ExceptionNotThrownException ' was thrown. 
Expected exception of type Exception of type 
'MbUnit.Core.Exceptions.ExceptionNotThrownException' was thrown., did 
not get it. 
        Source: MbUnit.Framework 
        StackTrace: 
        at
MbUnit.Core.Invokers.ExpectedExceptionRunInvoker.Execute(Object o, 
IList args) 
        at MbUnit.Core.RunPipeStarter.Run(Object fixture, Boolean
IsExplicit) 


[failure] myTestClass.MyRowTest (1,2,3) 
TestCase 'myTestClass.MyRowTest(1,2,3)' 
failed: Exception of type 
'MbUnit.Core.Exceptions.ExceptionNotThrownException' was thrown. 
Expected exception of type Exception of type 
'MbUnit.Core.Exceptions.ExceptionNotThrownException' was thrown., did 
not get it. 
        MbUnit.Core.Exceptions.ExceptionNotThrownException 
        Message: Exception of type 
'MbUnit.Core.Exceptions.ExceptionNotThrownException ' was thrown. 
Expected exception of type Exception of type 
'MbUnit.Core.Exceptions.ExceptionNotThrownException' was thrown., did 
not get it. 
        Source: MbUnit.Framework 
        StackTrace: 
        at
MbUnit.Core.Invokers.ExpectedExceptionRunInvoker.Execute(Object o, 
IList args) 
        at MbUnit.Core.RunPipeStarter.Run(Object fixture, Boolean
IsExplicit) 


[success] myTestClass.MyRowTest (0,2,3) 
[reports] generating HTML report 
TestResults:
file:///C:/Documents%20and%20Settings/ASDTM104/Application%20Data/MbUnit
/Reports/mbUnitTestProgram.Tests.html 


1 passed, 2 failed, 0 skipped, took 2.02 seconds. 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to