Firstly, I searched the forum (and google) and found
this. Sadly, none of the linked posts were helpful in solving my problem.
This is my test:
[TestFixture]
[Isolated]
public class GetExternalEndpointsActivityFixture
{
[Test]
public void Execute_WillReturnConfiguredExternalEndpoints()
{
Isolate.Fake.StaticMethods(typeof(ConfigurationManager));
var mySection = Isolate.Fake.Instance<MyConfigSection>();
var externalEndpointsCollection = Isolate.Fake.Instance<ExternalEndpointsCollection>();
Isolate.WhenCalled(() => mySection.ExternalEndpoints = externalEndpointsCollection);
var sectionName = "mySection";
Isolate.WhenCalled(() => ConfigurationManager.GetSection(sectionName)).WillReturn(mySection); // <-- This fails
}
}
I've removed anything that isn't related directly to the problem. On the final line, which is marked with a comment, TypeMock complains:
TypeMock.TypeMockException :
*** No method calls found in recording block. Please check:
* Are you trying to fake a field instead of a property?
* Are you are trying to fake an unsupported mscorlib type? See supported types here: https://www.typemock.com/mscorlib-types
This is a method, not a field, so I assume it isn't talking about that. Also, ConfigurationManager isn't part of the mscorlib, and I understand that what I am doing should be fully supported by TM.
The version I am using is 7.0.6.0
Thanks,
Gary