Skip to content

Result of a wild idea to mock a dependency at compile time for testing... Still not sure if this is very useful or not...

License

Notifications You must be signed in to change notification settings

ghotiphud/MsBuild-MockLibrary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MsBuild-MockLibrary

All the magic happens in the MockLibraryRunner.csproj file:

<Choose>
  <When Condition="'$(Configuration)'=='Debug'">
    <ItemGroup>
      <ProjectReference Include="..\MockLibrary\MockLibrary.csproj">
        <Project>{244665fb-5a3e-4659-bcd1-d9c4f1cc69d6}</Project>
        <Name>MockLibrary</Name>
      </ProjectReference>
    </ItemGroup>
  </When>
  <Otherwise>
    <ItemGroup>
      <ProjectReference Include="..\RealLibrary\RealLibrary.csproj">
        <Project>{d727350d-15bc-4aef-9a6f-892496ff2d9a}</Project>
        <Name>RealLibrary</Name>
      </ProjectReference>
    </ItemGroup>
  </Otherwise>
</Choose>

So, in Visual Studio, when you run the example app you should see different output in the console depending on the Build Configuration you've chosen (Debug/Release)

About

Result of a wild idea to mock a dependency at compile time for testing... Still not sure if this is very useful or not...

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages