#!/usr/bin/env bash
# {{ display_name }} MCP server — generated by mcpify. Do not hand-edit.
set -euo pipefail
cd "$(dirname "$0")/.."

dotnet test Tests --collect:"XPlat Code Coverage" --results-directory TestResults

if ! command -v reportgenerator >/dev/null 2>&1; then
  echo "note: 'reportgenerator' not found — install it for an HTML report:" >&2
  echo "  dotnet tool install --global dotnet-reportgenerator-globaltool" >&2
  exit 0
fi

reportgenerator \
  -reports:"TestResults/**/coverage.cobertura.xml" \
  -targetdir:"coveragereport" \
  -reporttypes:Html

echo
echo "Coverage written to:"
echo "  TestResults/**/coverage.cobertura.xml (machine-readable)"
echo "  coveragereport/index.html              (human-readable)"
