chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
I have somce code that worked in a previous version of isolator for .net. Recently upgraded to, and now, the .WillReturn method is throwing a NullReferenceException when it trying to use reflection to invoke a method.

Below I have included a portion of the test, and the first call to WillReturn() is throwing the exception.

Any ideas?

ObjectState setManager = new ObjectState(identity);
setManager.SetField("mManager", this.Manager);

System.Data.Common.DbDataReader fakeReader = Isolate.Fake.Instance<System>();

Isolate.WhenCalled(() => this.Manager.RunQuery((Tlr.Data.SqlQueryInformation)null)).WillReturn(null);

Isolate.WhenCalled(() => fakeReader.GetInt32(1)).WillReturn(1);

asked by cyost (1.1k points)

1 Answer

0 votes

It's hard to understand the problem from the what you posted.
Can you please post the full test code?
answered by ohad (35.4k points)