The only attribute you can use with a ProcessTestFixture is
TestSequence, it takes no notice of the CombinatorialTest attribute
which means that when the method is invoked no factories are run and no
parameters are provided.
Todd Menier wrote:
> Hello,
> I'm running some tests against a database and verifying that data inserts
> are getting rolled back. I'm doing this with a ProcessTestFixture that 1)
> counts rows in several tables, 2) does some work that should get rolled
> back, 3) count rows in the same tables. To make the test more maintainable,
> I use a CombinatorialTest against a Factory that returns table names.
>
> I get the following exception on the last test, and if I remove that test, I
> get the exception on the first test. I'm wondering if the framework doesn't
> allow parameters in TestSequence tests?
>
> Message: Parameter count mismatch.
>
> Type: System.Reflection.TargetParameterCountException
> Source: mscorlib
> TargetSite: System.Object Invoke(System.Object,
> System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[],
> System.Globalization.CultureInfo, Boolean)
> HelpLink: null
> Stack: at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
> BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
> culture, Boolean skipVisibilityChecks)
> at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
> invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
> at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
> at MbUnit.Core.TypeHelper.Invoke(MethodInfo method, Object o, IList args)
> at MbUnit.Core.Invokers.MethodRunInvoker.InvokeMethod(Object o, IList
> args)
> at MbUnit.Core.Invokers.MethodRunInvoker.Execute(Object o, IList args)
> at MbUnit.Core.RunPipeStarter.Run(Object fixture)
>
> Here is, approximately, the relevant part of my code:
>
> [ProcessTestFixture]
> public class TestEnvironmentRollbackTests
> {
> private Dictionary<string, int> _counts = new Dictionary<string,
> int>();
>
> [Factory(typeof(string))]
> public IEnumerable<string> Tables()
> {
> yield return "Company";
> yield return "User";
> yield return "Product";
> }
>
> [CombinatorialTest]
> [TestSequence(0)]
> public void PreCount([UsingFactories("Tables")] string table)
> {
> _counts[table] = Util.CountTableRows(table);
> }
>
> [Test]
> [TestSequence(1)]
> public void DoStuff()
> {
> // do stuff
> }
>
> [CombinatorialTest]
> [TestSequence(2)]
> public void PostCount([UsingFactories("Tables")] string table)
> {
> Assert.AreEqual(_counts[table], Util.CountTableRows(table));
> }
> }
>
> Thanks for any help,
> Todd
>
> ------=_Part_20391_4975519.1165360641481
> Content-Type: text/html; charset=ISO-8859-1
> X-Google-AttachSize: 3783
>
> Hello,<br>I'm running some tests against a database and verifying that data
> inserts are getting rolled back. I'm doing this with a ProcessTestFixture
> that 1) counts rows in several tables, 2) does some work that should get
> rolled back, 3) count rows in the same tables. To make the test more
> maintainable, I use a CombinatorialTest against a Factory that returns table
> names.
> <br><br>I get the following exception on the last test, and if I remove that
> test, I get the exception on the first test. I'm wondering if the framework
> doesn't allow parameters in TestSequence tests?<br><br>Message: Parameter
> count mismatch.
> <br><br>Type: System.Reflection.TargetParameterCountException<br>Source:
> mscorlib<br>TargetSite: System.Object Invoke(System.Object,
> System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[],
> System.Globalization.CultureInfo
> , Boolean)<br>HelpLink: null<br>Stack: at
> System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
> invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean
> skipVisibilityChecks)<br> at
> System.Reflection.RuntimeMethodInfo.Invoke
> (Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters,
> CultureInfo culture)<br> at
> System.Reflection.MethodBase.Invoke(Object obj, Object[]
> parameters)<br> at MbUnit.Core.TypeHelper.Invoke(MethodInfo
> method, Object o, IList args)
> <br> at MbUnit.Core.Invokers.MethodRunInvoker.InvokeMethod(Object
> o, IList args)<br> at
> MbUnit.Core.Invokers.MethodRunInvoker.Execute(Object o, IList
> args)<br> at MbUnit.Core.RunPipeStarter.Run(Object
> fixture)<br><br>
> Here is, approximately, the relevant part of my
> code:<br><br> [ProcessTestFixture]<br>
> public class TestEnvironmentRollbackTests<br>
> {<br> private Dictionary<string,
> int> _counts = new Dictionary<string, int>();
> <br><br>
> [Factory(typeof(string))]<br> public
> IEnumerable<string> Tables()<br>
> {<br> yield return
> "Company";<br>
> yield return "User";<br>
> yield return "Product";
> <br> }<br><br>
> [CombinatorialTest]<br>
> [TestSequence(0)]<br>
> public void PreCount([UsingFactories("Tables")] string
> table)<br> {<br>
> _counts[table] = Util.CountTableRows
> (table);<br> }<br><br>
> [Test]<br>
> [TestSequence(1)]<br> public void
> DoStuff()<br> {<br>
> // do stuff<br>
> }<br><br>
> [CombinatorialTest]<br> [TestSequence(2)]
> <br> public void
> PostCount([UsingFactories("Tables")] string
> table)<br> {<br>
> Assert.AreEqual(_counts[table],
> Util.CountTableRows(table));<br>
> }<br> }<br><br>Thanks for any help,
> <br>Todd<br><br>
>
> ------=_Part_20391_4975519.1165360641481--
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---