If I have a class with overloaded constructors which call other constructors using : this() syntax I get the following error:
Rbsfm.VTradeWeb.Core.TestClass.MockTest : System.ArgumentException : Item has already been added. Key in dictionary: "TypeMock.e" Key being added: "TypeMock.e"
e.g.
using System.Collections;
using NUnit.Framework;
using TypeMock;
namespace TypeMock.BugTest
{
public interface MockInterface
{}
public class MockClass : MockInterface
{
public MockClass() : this(null)
{}
public MockClass(ArrayList list)
{}
}
[TestFixture]
public class TestClass
{
[Test]
public void MockTest()
{
MockManager.Init();
Mock mock = MockManager.Mock(typeof(MockClass));
MockInterface mockClass;
mockClass = new MockClass();
mockClass = new MockClass();
}
}
}
The problem dissappears when the : this(null) is removed....
The problem also dissappears if I keep the : this(null) but only instantiate a single mock class but I had believed that using .Mock only mocked the *next* instance of a type....
I figure this is a bug :evil: but want to check first.... any help appreciated!