Skip to content

Instantly share code, notes, and snippets.

@wallymathieu
Last active November 6, 2019 23:14
Show Gist options
  • Save wallymathieu/00a97c7bcc7401cbf5ac48a0273359bd to your computer and use it in GitHub Desktop.
Save wallymathieu/00a97c7bcc7401cbf5ac48a0273359bd to your computer and use it in GitHub Desktop.

Revisions

  1. wallymathieu revised this gist Nov 6, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion LibWithTests.csproj
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    <TargetFramework Condition="$(Configuration)=='Test'">netcoreapp3.0</TargetFramework>
    <TargetFramework Condition="$(Configuration)!='Test'">netstandard2.0</TargetFramework>

    <IsPackable>false</IsPackable>
    <IsPackable Condition="$(Configuration)=='Test'">false</IsPackable>
    <DefineConstants Condition="$(Configuration)=='Test'">TESTS</DefineConstants>
    </PropertyGroup>

  2. wallymathieu created this gist Nov 6, 2019.
    18 changes: 18 additions & 0 deletions LibWithTests.csproj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    <Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
    <TargetFramework Condition="$(Configuration)=='Test'">netcoreapp3.0</TargetFramework>
    <TargetFramework Condition="$(Configuration)!='Test'">netstandard2.0</TargetFramework>

    <IsPackable>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>
    6 changes: 6 additions & 0 deletions Library.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    namespace LibWithTests
    {
    public class LibraryClass
    {
    }
    }
    16 changes: 16 additions & 0 deletions UnitTest1.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    using System;
    #if TESTS
    using Xunit;

    namespace LibWithTests
    {
    public class UnitTest1
    {
    [Fact]
    public void Test1()
    {

    }
    }
    }
    #endif