[CmdletBinding()]
param(
    [switch]$NoBuild
)

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
$testProject = Join-Path $repoRoot "src/ZB.MOM.WW.MxGateway.Tests/ZB.MOM.WW.MxGateway.Tests.csproj"
$arguments = @(
    "test",
    $testProject,
    "--filter",
    "ClientBehaviorFixtureTests"
)

if ($NoBuild) {
    $arguments += "--no-build"
}

& dotnet @arguments

if ($LASTEXITCODE -ne 0) {
    throw "Client behavior fixture validation failed with exit code $LASTEXITCODE."
}
