I set up a simple test project in Visual Studio 2010. For unit tests I use nunit 2.6.1 and for mocking FakeItEasy 1.7.4582.63 which I install via NuGet.
I try to fake a DbDataAdapter using the following code:
using System.Data.Common;
using FakeItEasy;
using NUnit.Framework;
namespace huhu
{
[TestFixture]
public class Class1
{
[Test]
public void test1()
{
A.Fake<DbDataAdapter>();
}
}
}
When I run the test using .NET framework 3.5 everything works fine and test1 will pass. But, when I set the framework version to .NET 4.0, I get the following exception:
FakeItEasy.Core.FakeCreationException :
Failed to create fake of type "System.Data.Common.DbDataAdapter".
Below is a list of reasons for failure per attempted constructor:
No constructor arguments failed:
No default constructor was found on the type System.Data.Common.DbDataAdapter.
The following constructors were not tried:
(*System.Data.Common.DbDataAdapter)
Types marked with * could not be resolved, register them in the current
IFakeObjectContainer to enable these constructors.
Any ideas how to make things work in .NET 4.0 are appreciated!
Bye, Jörg