← Back to team overview

nunit-core team mailing list archive

[Bug 441022] Re: Nunit 2.5.0.9122:setup not called when test method inherited

 

This is passing in the current. It was probably fixed as a side effect
of other changes.

** Changed in: nunitv2
       Status: New => Fix Committed

** Changed in: nunitv2
   Importance: Undecided => Medium

** Changed in: nunitv2
     Assignee: (unassigned) => Charlie Poole (charlie.poole)

** Changed in: nunitv2
    Milestone: None => 2.5.6

-- 
 Nunit 2.5.0.9122:setup not called when test method inherited
https://bugs.launchpad.net/bugs/441022
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.

Status in NUnit V2 Test Framework: Fix Committed

Bug description:
When a debugger is attached ( i.e., when I am running in Testdriven.net or NUnit GUI), I found that the Setup method wont' be called if my test method is  inherited from a base method.

Here's the code, the setupCount is  0, instead of the correct result, 2.

   public class SetupCallBase
   {
       protected int setupCount = 0;
       public virtual void Init()
       {
           setupCount++;
       }
       public virtual void AssertCount()
       {
       }
   }
   [TestFixture]
   public class SetupCallDerived: SetupCallBase
   {
       [SetUp]
       public override void Init()
       {
           setupCount++;
           base.Init();
       }
       [Test]
       public override void AssertCount()
       {
           Assert.AreEqual(2, setupCount);
       }
   }
As far as I know NUnit 2.4 will have the above test pass.

On the other hand, the test will also pass if I don't make the AssertCount as virtual/override.