XtremeIdiots.Portal.Repository.Api.Client.Testing
4.2.34
dotnet add package XtremeIdiots.Portal.Repository.Api.Client.Testing --version 4.2.34
NuGet\Install-Package XtremeIdiots.Portal.Repository.Api.Client.Testing -Version 4.2.34
<PackageReference Include="XtremeIdiots.Portal.Repository.Api.Client.Testing" Version="4.2.34" />
<PackageVersion Include="XtremeIdiots.Portal.Repository.Api.Client.Testing" Version="4.2.34" />
<PackageReference Include="XtremeIdiots.Portal.Repository.Api.Client.Testing" />
paket add XtremeIdiots.Portal.Repository.Api.Client.Testing --version 4.2.34
#r "nuget: XtremeIdiots.Portal.Repository.Api.Client.Testing, 4.2.34"
#:package XtremeIdiots.Portal.Repository.Api.Client.Testing@4.2.34
#addin nuget:?package=XtremeIdiots.Portal.Repository.Api.Client.Testing&version=4.2.34
#tool nuget:?package=XtremeIdiots.Portal.Repository.Api.Client.Testing&version=4.2.34
XtremeIdiots.Portal.Repository.Api.Client.Testing
Test helpers for consumer applications that depend on the Portal Repository API client. Provides in-memory fakes of IRepositoryApiClient, DTO factory methods, and DI extensions for integration tests.
Installation
dotnet add package XtremeIdiots.Portal.Repository.Api.Client.Testing
Quick Start — Integration Tests
Replace the real client with fakes in your test DI container:
services.AddFakeRepositoryApiClient(fakeClient =>
{
fakeClient.PlayersApi
.AddPlayer(RepositoryDtoFactory.CreatePlayer(username: "TestPlayer"))
.AddPlayer(RepositoryDtoFactory.CreatePlayer(username: "AnotherPlayer"));
fakeClient.GameServersApi
.AddGameServer(RepositoryDtoFactory.CreateGameServer(title: "Test Server"));
});
Quick Start — Unit Tests
Create and configure the fake client directly:
var fakeClient = new FakeRepositoryApiClient();
fakeClient.PlayersApi.AddPlayer(
RepositoryDtoFactory.CreatePlayer(
playerId: Guid.NewGuid(),
username: "TestPlayer",
gameType: GameType.CallOfDuty4));
var sut = new PlayerService(fakeClient);
var result = await sut.GetPlayer(playerId);
Assert.Equal("TestPlayer", result?.Username);
DTO Factories
RepositoryDtoFactory provides static factory methods with sensible defaults for all domain models:
RepositoryDtoFactory.CreatePlayer(playerId: Guid.NewGuid(), username: "TestPlayer");
RepositoryDtoFactory.CreateGameServer(gameServerId: Guid.NewGuid(), title: "My Server");
RepositoryDtoFactory.CreateAdminAction(adminActionId: Guid.NewGuid(), type: AdminActionType.Ban);
RepositoryDtoFactory.CreateReport(reportId: Guid.NewGuid());
RepositoryDtoFactory.CreateMap(mapId: Guid.NewGuid(), mapName: "mp_crossfire");
RepositoryDtoFactory.CreateUserProfile(userProfileId: Guid.NewGuid(), displayName: "Admin");
Configuring Error Responses
fakeClient.PlayersApi.AddErrorResponse(
"GetPlayer:404",
HttpStatusCode.NotFound,
"PlayerNotFound",
"Player does not exist");
Available Fake APIs
The FakeRepositoryApiClient exposes fake implementations for all API surfaces:
| Property | Fakes |
|---|---|
PlayersApi |
Player CRUD, search, tags, aliases |
GameServersApi |
Game server management |
AdminActionsApi |
Warnings, bans, kicks |
ReportsApi |
Player reports |
DemosApi |
Demo file management |
MapsApi |
Map data and voting |
LiveStatusApi |
Real-time server status and player tracking |
ChatMessagesApi |
Chat log retrieval |
GameServersStatsApi |
Server statistics |
GameServersEventsApi |
Server events |
BanFileMonitorsApi |
Ban file monitoring |
UserProfileApi |
User profiles and claims |
PlayerAnalyticsApi |
Player analytics data |
RecentPlayersApi |
Recent player tracking |
DataMaintenanceApi |
Data maintenance operations |
TagsApi |
Tag management |
Resetting State Between Tests
fakeClient.Reset(); // Clears all configured responses
License
This project is licensed under the GPL-3.0-only license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- MX.Api.Abstractions (>= 2.3.77)
- XtremeIdiots.Portal.Repository.Abstractions.V1 (>= 4.2.34)
- XtremeIdiots.Portal.Repository.Abstractions.V2 (>= 4.2.34)
- XtremeIdiots.Portal.Repository.Api.Client.V1 (>= 4.2.34)
- XtremeIdiots.Portal.Repository.Api.Client.V2 (>= 4.2.34)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- MX.Api.Abstractions (>= 2.3.77)
- XtremeIdiots.Portal.Repository.Abstractions.V1 (>= 4.2.34)
- XtremeIdiots.Portal.Repository.Abstractions.V2 (>= 4.2.34)
- XtremeIdiots.Portal.Repository.Api.Client.V1 (>= 4.2.34)
- XtremeIdiots.Portal.Repository.Api.Client.V2 (>= 4.2.34)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.2.34 | 95 | 9/1/2026 |
| 4.2.33 | 95 | 9/1/2026 |
| 4.2.30 | 97 | 8/30/2026 |
| 4.2.29 | 93 | 8/30/2026 |
| 4.2.27 | 93 | 8/30/2026 |
| 4.2.22 | 192 | 8/3/2026 |
| 4.2.21 | 112 | 8/2/2026 |
| 4.2.18 | 111 | 8/2/2026 |
| 4.2.16 | 113 | 7/30/2026 |
| 4.2.15 | 110 | 7/28/2026 |
| 4.2.13 | 110 | 7/26/2026 |
| 4.2.9 | 133 | 7/18/2026 |
| 4.2.8 | 102 | 7/18/2026 |
| 4.2.7 | 105 | 7/18/2026 |
| 4.2.6 | 108 | 7/17/2026 |
| 4.2.4 | 105 | 7/17/2026 |
| 4.2.1 | 107 | 7/17/2026 |
| 4.1.1 | 129 | 7/8/2026 |
| 4.0.11 | 118 | 7/8/2026 |
| 4.0.8 | 136 | 7/4/2026 |