Ehud,
I think this is how it is supposed to work and that there is logic
behind this.
The overall logic is that MbUnit first uses the attributes to build out
of all of the test cases, and then, as a second operation, it runs the
tests. This is most obvious in the GUI, where you can launch the GUI
for a combinatorial test, see all the possible combinations, then run
any combination individually as it you had separately coded each test.
Have you tried putting code in fixture's constructor and seeing if that
does what you need?
I have just wrote a helper method to get the connection and close it
during build out, and then used the same helper method during test
running (with connection pooling it's probably the same connection
anyway). Here's an example of the factory method:
[Factory(typeof(string))]
public IEnumerable Reports()
{
ArrayList reports = new ArrayList();
using(SqlConnection connection =
Helper.GetOpenDatabaseConnection())
{
SqlCommand command = new SqlCommand(@"
select Report
From sysReports r
where r.UseCrystal = 1
and r.Active = 1
and r.Report != '' /* not custom reports */
", connection);
SqlDataReader dr = command.ExecuteReader();
while(dr.Read())
{
reports.Add(dr.GetString(0));
}
dr.Close();
}
string[] reportsArray = new string[reports.Count];
reports.CopyTo(reportsArray);
return reportsArray;
}
Hope this helps, Marc
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---