k i will explain more...
i have build a Class to test GridControls. That Class make extensive use of
MockManager.MockAll(typeof(GridControl));
and i call that class in a formFixture test method
[TestFixture]
public class FormFixture
{
[Test]
public void testGridControl()
{
GridTester tester=new GridTester("gridControlName");
tester.AssertGridView();
}
}
suppose that i want to make a setup method also like
[SetUp]
public void SetUp()
{
Mock mockGridControl = MockManager.MockAll(typeof(GridControl));
mockGridControl.ExpectSet("DataSource").Args(Check.IsAny());
mockGridControl.Verify();
mockGridControl.Clear();
}
but when i try to execute the whole fixture
[SetUp]
public void SetUp()
{
Mock mockGridControl = MockManager.MockAll(typeof(GridControl));
mockGridControl.ExpectSetAlways("DataSource").Args(Check.IsAny());
mockGridControl.Verify();
mockGridControl.Clear();
}
[Test]
public void testGridControl()
{
GridTester tester=new GridTester("gridControlName");
tester.AssertGridView();
}
it will fail with the message that i cannot MockAll the same GridView twice (cuase AssertGridView uses MockManager.MockAll(typeof(GridControl));)
of course i could overcome the problem creating an overload of AssertGridView method with a mock object as parameter, but i just wondering if there is another way
hope i make myself clearer this time