I have an interface in the .NET 4.5 class library (not 4.6),
public interface IBrokenFakeInterface { Claim WhyWontItGenerateFakeOfThisInterface(); }
In my unit test (MSTest) project, when I added Fakes for the corresponding assembly containing this interface, I get a compiler warning saying that it cannot create a stub.
Warning: it is not possible to create a stub for ClassLibrary1.IBrokenFakeInterface: method System.Security.Claims.Claim ClassLibrary1.IBrokenFakeInterface.WhyWontItGenerateFakeOfThisInterface () unubbable: the method is abstract and cannot be cut, the type System.Security.Claims.Claim is not available in the target structure. ClassLibrary1Tests C: \ Users \ jacobsonba \ Documents \ Visual Studio 2015 \ Projects_tempFakeFiguringOut \ ClassLibrary1Tests \ Fakes \ ClassLibrary1.fakes
Although this is only a compiler warning, it leads to compiler errors when the unit test project relies on a StubIBrokenFakeInterface because a specific Stub type is not created by the fake generator.
Does anyone know the cause of this error and the resolution? Changing projects to .NET 4.6 allows it, but this is not a reasonable option for these projects for us. The exact code is compiled simply in VS2013; in fact, if it is compiled with VS2013, then open the solution in VS2015, it continues to work until the Fakes assembly is regenerated. Thus, it is obvious that the problem is in the fake generator that uses VS2015.
BrettJ Jul 21 '15 at 13:50 2015-07-21 13:50
source share