Nunit 2.5.0.9122:setup not called when test method inherited

Bug #441022 reported by Ngu Soon Hui
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit V2
Fix Released
Medium
Charlie Poole

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.

Tags: confirm

Related branches

tags: added: confirm
Revision history for this message
Charlie Poole (charlie.poole) wrote :

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

Changed in nunitv2:
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Charlie Poole (charlie.poole)
milestone: none → 2.5.6
Changed in nunitv2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.