Will it be possible to assign the Column attribute to a method instead
assigning it to a public properties? My example was a little bit dumb but
in my real case, the configuration that I need to apply need a couple line
of codes.
So, would it be possible to do something like that:
[Column("1", "2", "3")]
public void ApplyConfiguration(string paramValue)
{
if (paramValue == "1")
DoSomething();
else if (paramValue == "2")
DoSomethingElse();
else if (paramValue == "3")
AnotherCall();
}
On Dec 17, 2007 2:45 PM, Jeff Brown <[EMAIL PROTECTED]> wrote:
>
> My suggestion would be to hold off until MbUnit v3 alpha 2 is released (in
> a
> couple weeks we hope) and then to use the new data-driven testing features
> like this:
>
> [TestFixture]
> public class MyFixture
> {
> [Column("1", "2", "3")]
> // equivalent to: [Row("1"), Row("2"), Row("3")]
> public string param;
>
> [Test]
> [Row("a", "z")]
> [Row("b", "y")]
> public void Test(string x, string y)
> {
> }
> }
>
> The Test method will be run 6 times with:
>
> param="1", x="a", y="z"
> param="1", x="b", y="y"
> param="2", x="b", y="y"
> param="2", x="b", y="y"
> param="3", x="b", y="y"
> param="3", x="b", y="y"
>
> Jeff.
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Yanick Masse
> Sent: Monday, December 17, 2007 9:55 AM
> To: MbUnit.User
> Subject: MbUnit Multi Setup Fixture
>
>
> Hi,
>
> I would like to develop a special fixture in which it would be a mix
> of the RowTestAttribute and TestFixtureSetUpAttribute. Multiple
> "MultiSetUp" attributes could be applied to a SetUp function. Tests
> functions decorated with TestAttributes would be called once for each
> occurence of the MultiSetUp function.
>
> Here is a little example of this special fixture.
>
> [MultiSetUpFixture]
> public class TestMultiSetUpFixture
> {
> [MultiSetUp("1")]
> [MultiSetUp("2")]
> [MultiSetUp("3")]
> public void MultiSetUp(string param1)
> {
> // Do some setup using param1...
> }
>
> [Test]
> public void Test1()
> {
> }
>
> [Test]
> public void Test2()
> {
> }
>
> [MultiSetUpTearDown]
> public void MultiSetUpTearDown()
> {
> }
> }
>
> In this example, the methods would be invoked in the following order when
> running the test:
>
> MultiSetUp("1")
> Test1()
> Test2()
> MultiSetUpTearDown()
> MultiSetUp("2")
> Test1()
> Test2()
> MultiSetUpTearDown()
> MultiSetUp("3")
> Test1()
> Test2()
> MultiSetUpTearDown()
>
> Does someone have any hints to help me implement this special fixture or
> another suggestions? My goal is to run my tests on multiple configuration
> but I don't want my configuration to be applied for each test method.
>
>
> >
>
--
--------------------------------------
Yanick Masse
[EMAIL PROTECTED]
514-813-3635
www.myspace.com/hefters
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---