Kanject.Core.Realtime.TestKit
1.3.0
Prefix Reserved
dotnet add package Kanject.Core.Realtime.TestKit --version 1.3.0
NuGet\Install-Package Kanject.Core.Realtime.TestKit -Version 1.3.0
<PackageReference Include="Kanject.Core.Realtime.TestKit" Version="1.3.0" />
<PackageVersion Include="Kanject.Core.Realtime.TestKit" Version="1.3.0" />
<PackageReference Include="Kanject.Core.Realtime.TestKit" />
paket add Kanject.Core.Realtime.TestKit --version 1.3.0
#r "nuget: Kanject.Core.Realtime.TestKit, 1.3.0"
#:package Kanject.Core.Realtime.TestKit@1.3.0
#addin nuget:?package=Kanject.Core.Realtime.TestKit&version=1.3.0
#tool nuget:?package=Kanject.Core.Realtime.TestKit&version=1.3.0
Kanject.Core.Realtime.TestKit
The contract suite every realtime transport passes (Core proposal 0058 §5), plus doubles for a product's own tests.
Installation
dotnet add package Kanject.Core.Realtime.TestKit
Targets .NET 9, .NET 10 and .NET 11. It is an xUnit kit, not a test project: your test project brings its own xunit and runner.
Testing a product
RecordingRealtimePublisher stands in for IRealtimePublisher. It records each publish as the envelope a client would receive and holds it to the same message-type and payload-ceiling rules:
var realtime = new RecordingRealtimePublisher();
await new ConversationBroadcaster(realtime).MessageAddedAsync(conversation, added, ct);
var published = Assert.Single(realtime.Published);
Assert.Equal("message_added", published.Envelope.Type);
InProcessRealtimeTransportHost runs the in-process transport end to end with any authorizer. TestRealtimeAuthorizer issues tokens for users and decides topics through a predicate.
Testing a transport
A provider derives from RealtimeTransportContractTests and returns its transport through an IRealtimeTransportHost:
public sealed class MyTransportContractTests : RealtimeTransportContractTests
{
protected override Task<IRealtimeTransportHost> CreateHostAsync(TestRealtimeAuthorizer authorizer) =>
Task.FromResult<IRealtimeTransportHost>(new MyTransportHost(authorizer));
}
The suite covers the publish contract and Core's subscription rules:
- delivery to a user, to several users and to a topic, and to nobody else;
- the payload ceiling;
- the envelope's fields;
- refusal of another user's channel, a wildcard, another tenant, an expired principal and a refused topic.
A test the transport's capabilities rule out is skipped, not failed.
License
Licensed under the Kanject Code Libraries License Agreement (KCLLA); the full text ships in this package as LICENSE.md. Organizations whose trailing-twelve-month gross revenue and total funding raised are each below US$250,000 may use it at no cost under the Free Tier. At or above either threshold a commercial license is required — contact commercial@kanjectbusiness.com.
| 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. net11.0 is compatible. |
-
net10.0
- Kanject.Core.Realtime (>= 1.3.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.15)
- xunit (>= 2.9.3)
- Xunit.SkippableFact (>= 1.5.85)
-
net11.0
- Kanject.Core.Realtime (>= 1.3.0)
- Microsoft.Extensions.DependencyInjection (>= 11.0.0)
- xunit (>= 2.9.3)
- Xunit.SkippableFact (>= 1.5.85)
-
net9.0
- Kanject.Core.Realtime (>= 1.3.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.23)
- xunit (>= 2.9.3)
- Xunit.SkippableFact (>= 1.5.85)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Takes Kanject.Core.Realtime 1.3.0.