Skip to content

Add Unity GSDK unit tests and CI workflow#193

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-unit-tests-unity-gsdk
Draft

Add Unity GSDK unit tests and CI workflow#193
Copilot wants to merge 3 commits intomainfrom
copilot/add-unit-tests-unity-gsdk

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

What this PR does / why we need it:

Adds standalone unit tests for the Unity GSDK model/helper classes and a GitHub Actions workflow to run them on PRs, matching the pattern established in #191 (C#) and #192 (C++).

The Unity SDK's model classes (GSDKConfiguration, SessionConfig, HeartbeatRequest/Response, MaintenanceSchedule, etc.) and SimpleJson helpers have no Unity engine dependencies, so they compile and test in a standard .NET project without requiring Unity Editor.

Test project (UnityGsdk/Tests/Tests.csproj):

  • Compiles source files via <Compile Include="..." Link="..." /> — no separate library project needed
  • 34 tests across three files:
    • GSDKConfigurationTests — config parsing, env vars, certificates, ports, round-trip serialization
    • SessionConfigTestsCopyNonNullFields, equality operators, hash code
    • SerializationTests — heartbeat request/response, maintenance schedule V2, connected players, all GameState/GameOperation enum values

CI workflow (.github/workflows/unity-tests.yml):

  • Triggers on PRs touching UnityGsdk/**
  • ubuntu-latest, .NET 10.0.x, dotnet test

Other:

  • UnityGsdk/.gitignore — added !Tests/Tests.csproj exception (existing gitignore excludes *.csproj)
  • UnityGsdk/README.md — added FAQ section clarifying that the Tests/ folder is for development/CI only and does not need to be included when integrating the Unity GSDK; also fixed a pre-existing "scripring" → "scripting" typo

Special notes for your reviewer:

MSTest package versions match csharp/Tests/Tests.csproj for consistency.

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Create test project (UnityGsdk/Tests/Tests.csproj) that compiles model
  and helper source files without Unity engine dependencies
- Add GSDKConfigurationTests: config parsing, env vars, round-trip
- Add SessionConfigTests: CopyNonNullFields, equality, hash code
- Add SerializationTests: heartbeat request/response, maintenance schedule,
  connected players, game state/operation enum serialization
- Add CI workflow (.github/workflows/unity-tests.yml) triggered on PRs
  with changes to UnityGsdk/** paths
- Update UnityGsdk/.gitignore to allow Tests/Tests.csproj

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit tests for Unity GSDK and integrate with PR Add Unity GSDK unit tests and CI workflow Mar 3, 2026
@dgkanatsios
Copy link
Copy Markdown
Contributor

@copilot can you amend the Unity GSDK readme to mention that these files don't need to be included when someone uses the Unity GSDK?

@dgkanatsios
Copy link
Copy Markdown
Contributor

@copilot can you retry?

Co-authored-by: dgkanatsios <8256138+dgkanatsios@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot can you retry?

Added a "What is the Tests/ folder?" section to UnityGsdk/README.md clarifying that it's for development/CI only and doesn't need to be included when using the SDK. Also fixed a pre-existing "scripring" → "scripting" typo. See commit 7c97a23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants