Hi!
I'm having an issue with a very simple test that is mocking the static constructors of the test class.
Every time I run this test with code coverage on, I get an AccessViolationException.
The interesting thing is that this error didn't occur before (I think). It started at some point that now I can't figure out.
I'm using only the Visual Studio Unit Testing Framework.
The test method is quite simple:
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[SuppressMessage("Microsoft.Usage", "CA1806")]
public void CreateTest1()
{
// Mock Repository NHibernate
using (RecordExpectations recorder = new RecordExpectations())
{
new RepositoryNHibernate(typeof(Customer).Name);
recorder.MockStaticConstructors();
}
// Test
Repository target = new Repository(typeof(Customer).Name);
target.Create(null);
}
I've setup a TestInitialize method that is calling MockManager.Init() and a TestCleanUp that is calling MockManager.Verify() and MockManager.ClearAll().
The error is actually occurring in the second creation of Repository (outside the recorder).
Am I doing something wrong or is this a compatibility issue between TypeMock and TFS Code Coverage?
Please help. Thanks in advance.
Hugo