4

I'm trying to use Microsoft Fakes for my unit tests. I've referenced assembly under test in test project, then right clicked it and clicked "Add Fakes Assembly". As a result *.fakes file was created under the Fakes folder, but Fakes Assembly was not created under the FakesAssemblies folder. Following this post: Fakes assembly is not generating I've edited the relevant *.fakes file to look like this:

<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/"
       Diagnostic="true">
  <Assembly Name="[assembly name]" />
  <StubGeneration>
    <Clear />
  </StubGeneration>
  <ShimGeneration>
    <Clear />
    <Add Namespace="[namespace that the 1 class I want to shim is in]" />
  </ShimGeneration>
</Fakes>

Which didn't solve the problem. When my test project is built I see the following warning: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Fakes\Microsoft.QualityTools.Testing.Fakes.targets(128,5): warning : could not resolve assembly [Assembly under test].exe from the references". So I guess this is the problem. I don't understand why this happens because without Fakes the [Assembly under test] is loaded normally and can be referenced in test.

I thought it might have to do with .exe extension, but I've tried adding a reference to some other .exe file and adding Fake assembly for it and it worked fine.

I'm using VS Ultimate.

Any suggestions how to solve this? Thanks!

Community
  • 1
  • 1
polina
  • 41
  • 4

0 Answers0