Skip to content

Instantly share code, notes, and snippets.

@wallymathieu
Last active November 6, 2019 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wallymathieu/00a97c7bcc7401cbf5ac48a0273359bd to your computer and use it in GitHub Desktop.
Save wallymathieu/00a97c7bcc7401cbf5ac48a0273359bd to your computer and use it in GitHub Desktop.
namespace LibWithTests
{
public class LibraryClass
{
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework Condition="$(Configuration)=='Test'">netcoreapp3.0</TargetFramework>
<TargetFramework Condition="$(Configuration)!='Test'">netstandard2.0</TargetFramework>
<IsPackable Condition="$(Configuration)=='Test'">false</IsPackable>
<DefineConstants Condition="$(Configuration)=='Test'">TESTS</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="$(Configuration)=='Test'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.0.1" />
</ItemGroup>
</Project>
using System;
#if TESTS
using Xunit;
namespace LibWithTests
{
public class UnitTest1
{
[Fact]
public void Test1()
{
}
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment