views:

526

answers:

1

Getting an odd problem with a unit test in my solution. One of the test always fails with the following error message:

The member specified (BuildMap) could not be found. You might need to regenerate your private accessor, or the member may be private and defined on a base class. If the latter is true, you need to pass the type that defines the member into PrivateObject's constructor.

BuildMap is private and I have tried regenerating the accessor, changing it to public and recreating the unit test and it continuously fails. The other methods (both public and private) all work fine. BuildMap is also not defined in a base class.

Also tried all the usual things in case VS is messing about, restarting it, clean assemblies, rebuild etc...

Any ideas on the cause?

update 1: This is in Visual Studio 2008 or on the command line mstest tool.
update 2: Tried renaming the BuildMap method and the tests would not build stating it was missing. Appears that Visual Studio/MSBuild is doing the right thing, but somewhere between it and mstest it is breaking.

A: 

Oddly enough when I changed the method from static to not static the issue resolved itself. Other private static methods work fine though. Still not sure of the cause but that is the resolution.

Robert MacLean