I have a referenced nuget package that contains an interface:
public interface IMyInterface {
bool Initialize(Dictionary<string, dynamic> initArguments);
}
In my solution I have this implementation:
public class MyImplementation : IMyInterface
{
public bool Initialize(Dictionary<string, dynamic> initArguments)
{
return true;
}
}
If I use it in a console project, it works without problem:
var myImplementation = new MyImplementation();
But i if try to use it in a unit test project is throws this:
System.TypeLoadException : Method 'Initialize' in type 'xxx.MyImplementation' from assembly 'xxx, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
This is my unit test:
[Fact]
public void Test1()
{
var myImplementation = new MyImplementation();
Assert.NotNull(myImplementation);
}
I think it is maybe because the Dictionary<string, dynamic>
parameter, something related to that dynamic
but not sure. I have google it a lot without luck.
Update
If I check the interface referenced from nuget package it is like this:
public interface IMyInterface {
bool Initialize([Dynamic(new[] { false, false, true })] Dictionary<string, dynamic> initArguments);
}
I dont know what why the compiled version of the nuget package is like that, with the Dynamic
data attribute in the param.