[Test]
public void LoadingPropertiesUsingAttributesLoadsCorrectValues()
{
var collectionFake = Isolate.Fake.Instance<PropertyCollection>();
Isolate.SwapNextInstance<PropertyCollection>();
Isolate.WhenCalled(() => collectionFake.Add(new Property("", null))).IgnoreCall(); //note, have to use bogus params for prop object ctor or it throws exception
var mFake = Isolate.Fake.Instance<Mod>();
Isolate.SwapNextInstance<Mod>();
Isolate.WhenCalled(() => mFake.LoadPropertiesUsingAttributes()).CallOriginal();
Isolate.WhenCalled(() => mFake.AddProperty(new Property("", null))).CallOriginal();
var m = new ModTest();
m.LoadPropertiesUsingAttributes();
//Erroring line below
Isolate.Verify.WasCalledWithAnyArguments(() => m.AddProperty(new Property("AppName", this)));
Isolate.Verify.WasCalledWithAnyArguments(() => m.AddProperty(new Property("ShouldShowDetails", this)));
Isolate.Verify.WasNotCalled(() => m.AddProperty(new Property("ShouldNotFind", this)));
}
Results in an error:
ModTest.LoadingPropertiesUsingAttributesLoadsCorrectValues:
TypeMock.TypeMockException :
*** Isolate.Verify does not support objects that were not faked using Isolate.Fake.Instance(), or passed through WhenCalled()
at dp.a()
at cm.a(Delegate A_0)
at cm.d(Delegate A_0)
at cm.b(Action A_0)
at Nucleo.Model.BaseModuleTest.LoadingPropertiesUsingAttributesLoadsCorrectValues()
What object didn't I fake or call WhenCalled for? Is it the Property objects I have to do that for too? Any insight would be helpful.
Thanks.