MudassarRasool / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

TestFixtureSetUp method is not called if marked as static #703

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
If the method marked with the TestFixtureSetUp attribute is static, it will not 
be executed, even though the documentation for the TestFixtureSetUp specifies 
that "The method may be static". This is probably caused by the flags passed to 
the reflection method lookup. This can easily be repro'd:

[TestFixture]
public class BugReportRepro
{
    private static object _sTest;

    [TestFixtureSetUp]
    public static void SetTest()
    {
        _sTest = new object();
    }

    [Test]
    public void Test()
    {
        Assert.IsNotNull(_sTest);
    }
}

This test fails in MBUnit 2.4.2.355, both the command line and UI, running on 
.NET 2.0 on Windows XP, but by changing the method definition of SetTest to 
instance, it passes.

Original issue reported on code.google.com by richardw...@googlemail.com on 5 Aug 2010 at 3:24

GoogleCodeExporter commented 8 years ago

Original comment by Yann.Tre...@gmail.com on 12 Aug 2010 at 5:56

GoogleCodeExporter commented 8 years ago
Sorry but MbUnit v2 is no longer maintained.

We recommend to update your test projects with Gallio/MbUnit v3.
You might use "MbUnit.Compatibility" to mitigate the migration effort.

Original comment by Yann.Tre...@gmail.com on 21 Sep 2010 at 7:51