here's the test code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MbUnit.Framework;
using TypeMock.ArrangeActAssert;
using TypeMock;
namespace MBUnitProblem
{
[TestFixture, ClearMocks]
public class BaseFixture
{
protected int count;
[FixtureSetUp]
public void FixtureSetUp()
{
}
[SetUp]
public virtual void SetUp()
{
}
[TearDown]
public void Clean()
{
count = 0;
}
}
public class DerivedFixture : BaseFixture
{
public override void SetUp()
{
base.SetUp();
count++;
Assert.AreEqual<int>(1, count);
}
[Test, Isolated]
public void test1()
{
}
[Test, Isolated]
public void test2()
{
}
}
}
You will get two failures
TestCase 'MbUnit v3.0.6.763/MBUnitProblem/DerivedFixture/test1' failed:
Expected values to be equal.
Expected Value : 1
Actual Value : 2
C:Documents and Settings estMy DocumentsMahaLongMBUnitProblemMBUnitProblemClass1.cs(45,0): at MBUnitProblem.DerivedFixture.SetUp()
TestCase 'MbUnit v3.0.6.763/MBUnitProblem/DerivedFixture/test2' failed:
Expected values to be equal.
Expected Value : 1
Actual Value : 2
C:Documents and Settings estMy DocumentsMahaLongMBUnitProblemMBUnitProblemClass1.cs(45,0): at MBUnitProblem.DerivedFixture.SetUp()
Disposing the test runner.
But if you remove all the typemock reference then there is no such problem.
I am using MBUnit, not sure whether the same problem occurs in other framework, though. I am using TestDriven.net
________
Big dick video