<!-- xunit v3 (xunit.v3 3.2.2). NModbus 3.0.83 — small footprint, net10.0 compatibility, and
     synchronous/async FC03/FC16 API that maps directly to the Modbus PDU function codes used
     in smoke and e2e tests. -->
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <IsPackable>false</IsPackable>
    <IsTestProject>true</IsTestProject>
    <RootNamespace>Mbproxy.Tests</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
    <PackageReference Include="xunit.v3" Version="3.2.2" />
    <PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Shouldly" Version="4.3.0" />
    <!-- NModbus: Modbus TCP client for simulator smoke tests and e2e tests. -->
    <PackageReference Include="NModbus" Version="3.0.83" />
  </ItemGroup>

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

  <!-- The linked appsettings.json from Mbproxy.csproj propagates to the test bin via the
       project reference. Tests build their own in-memory configurations and must not pick
       up the shipped template's example PLCs. This target deletes the inherited file from
       both the build output AND the publish payload so a `dotnet publish` against this
       csproj for a packaged self-test would not leak the template's example PLCs into the
       published bundle. -->
  <Target Name="RemoveInheritedAppsettings" AfterTargets="Build;Publish">
    <Delete Files="$(OutputPath)appsettings.json" Condition="Exists('$(OutputPath)appsettings.json')" />
    <Delete Files="$(PublishDir)appsettings.json" Condition="'$(PublishDir)' != '' AND Exists('$(PublishDir)appsettings.json')" />
  </Target>

</Project>
