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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XtremeIdiots.Portal.Repository.Api.Client.Testing" Version="4.2.34" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XtremeIdiots.Portal.Repository.Api.Client.Testing" Version="4.2.34" />
                    
Directory.Packages.props
<PackageReference Include="XtremeIdiots.Portal.Repository.Api.Client.Testing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XtremeIdiots.Portal.Repository.Api.Client.Testing --version 4.2.34
                    
#r "nuget: XtremeIdiots.Portal.Repository.Api.Client.Testing, 4.2.34"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package XtremeIdiots.Portal.Repository.Api.Client.Testing@4.2.34
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XtremeIdiots.Portal.Repository.Api.Client.Testing&version=4.2.34
                    
Install as a Cake Addin
#tool nuget:?package=XtremeIdiots.Portal.Repository.Api.Client.Testing&version=4.2.34
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed