<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <OutputType>Exe</OutputType>
    <RootNamespace>GroundsForSupport.API.Tests</RootNamespace>
    <TargetFramework>net10.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
  </ItemGroup>

  <ItemGroup>
    <Using Include="Xunit" />
    <Using Include="AwesomeAssertions" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="AwesomeAssertions" Version="9.3.0" />
    <PackageReference Include="coverlet.collector" Version="6.0.4">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="coverlet.msbuild" Version="6.0.4">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.1" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
    <PackageReference Include="xunit.v3" Version="3.2.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>

  <PropertyGroup>
    <CollectCoverage>true</CollectCoverage>
    <CoverletOutput>./TestResults/Coverage/</CoverletOutput>
    <CoverletOutputFormat>cobertura</CoverletOutputFormat>
    <Include>[GroundsForSupport.Server]*</Include>
    <ExcludeByFile>**/Program.cs</ExcludeByFile>
  </PropertyGroup>

  <Target Name="GenerateHtmlCoverageReport" AfterTargets="GenerateCoverageResultAfterTest">
    <Exec Command="reportgenerator -reports:./TestResults/Coverage/*.xml -targetdir:./TestResults/Coverage/Report/ -reporttypes:Html_Dark" />
  </Target>

  <ItemGroup>
    <ProjectReference Include="..\..\src\GroundsForSupport.Server\GroundsForSupport.Server.csproj" />
  </ItemGroup>

  <Target Name="TestClient" AfterTargets="VSTest">
    <Message Text="Testing client..." Importance="high" />
    <Exec Command="npm run test" WorkingDirectory="../../src/GroundsForSupport.Client" />
  </Target>

</Project>
