I am seeing this error running tests on the build/test server. This is a com interop object being mocked.
Error: Missing method 'instance object [FwRulesNetCSharp] FwBaseLib.IFwAttribute::get_Value()' from class 'Mock0003FwAttribute'. - VB Error 0 -
locally the tests pass without any failures.
Now I found a solution but need to understand why.
my mock is such:
var fakeAttributes = Isolate.Fake.Instance<FwAttributes>(Members.ReturnNulls);
Isolate.WhenCalled(() => fakeAttributes.Count).WillReturn(attributes.Rank);
for (int i = 0; i < attributes.GetLength(0); i++)
{
var fakeAttribute = Isolate.Fake.Instance<FwAttribute>(Members.CallOriginal);
Isolate.WhenCalled(() => fakeAttribute.Value).WillReturn(attributes[i, 0]);
Isolate.WhenCalled(() => fakeAttribute.Name).WillReturn(attributes[i, 1]);
Isolate.WhenCalled(() => fakeAttributes.get_Key(i)).WillReturn(attributes[i, 1]);
Isolate.WhenCalled(() => fakeAttributes.get_Value(i)).WillReturn(fakeAttribute);
}
This FwAttrbute object has an interface on it.
The problem is the value method.
signatures are:
string _Value { get; set; }
Member of FwBaseLib.IFwAttribute
and
dynamic Value { get; set; }
Member of FwBaseLib.IFwAttribute
The code is such
string val = Attributes.Value[i].Value;
passes running test in visual studio but fails on the build server.
I change to
string val = Attributes.Value[i]._Value;
and it passes in both places.
What gives? Is because it is dynamic?
gilstrac