npc-clients-csharp/TESTING.md

79 lines
No EOL
1.7 KiB
Markdown

# Running C# Tests on Fedora
## Prerequisites
### Install .NET SDK on Fedora
```bash
# Install .NET 8 SDK (current LTS, recommended)
sudo dnf install dotnet-sdk-8.0
# Or for .NET 6.0 (older LTS, still supported)
sudo dnf install dotnet-sdk-6.0
# Or for .NET 9.0 (latest, STS)
sudo dnf install dotnet-sdk-9.0
# Verify installation
dotnet --version
```
### .NET Version Support
- **.NET 8.0** - Current LTS (Long Term Support), supported until November 2026
- **.NET 6.0** - Previous LTS, supported until November 2024
- **.NET 9.0** - Latest version (Standard Term Support)
Our SDK targets .NET 6.0+ for maximum compatibility.
## Running Tests
### From the clients directory:
```bash
make test-csharp
```
### From the csharp directory:
```bash
cd csharp
dotnet test GumYum.NPC.Tests/GumYum.NPC.Tests.csproj
```
### Run with detailed output:
```bash
dotnet test GumYum.NPC.Tests/GumYum.NPC.Tests.csproj -v detailed
```
### Run with code coverage:
```bash
dotnet test GumYum.NPC.Tests/GumYum.NPC.Tests.csproj --collect:"XPlat Code Coverage"
```
## Troubleshooting
### If .NET is not found:
```bash
# Check if .NET is installed
which dotnet
# List available .NET packages
dnf search dotnet-sdk
# Install specific version
sudo dnf install dotnet-sdk-6.0
```
### If tests fail to build:
```bash
# Restore packages first
dotnet restore GumYum.NPC.Tests/GumYum.NPC.Tests.csproj
# Then build
dotnet build GumYum.NPC.Tests/GumYum.NPC.Tests.csproj
# Then test
dotnet test GumYum.NPC.Tests/GumYum.NPC.Tests.csproj
```
## Unity Tests
Unity tests require the Unity Editor and cannot be run from command line on Fedora without Unity. They must be run within the Unity Test Runner in the Unity Editor.