CasCap.Signalizr.Client.Testing
1.3.0
Prefix Reserved
dotnet add package CasCap.Signalizr.Client.Testing --version 1.3.0
NuGet\Install-Package CasCap.Signalizr.Client.Testing -Version 1.3.0
<PackageReference Include="CasCap.Signalizr.Client.Testing" Version="1.3.0" />
<PackageVersion Include="CasCap.Signalizr.Client.Testing" Version="1.3.0" />
<PackageReference Include="CasCap.Signalizr.Client.Testing" />
paket add CasCap.Signalizr.Client.Testing --version 1.3.0
#r "nuget: CasCap.Signalizr.Client.Testing, 1.3.0"
#:package CasCap.Signalizr.Client.Testing@1.3.0
#addin nuget:?package=CasCap.Signalizr.Client.Testing&version=1.3.0
#tool nuget:?package=CasCap.Signalizr.Client.Testing&version=1.3.0
CasCap.Signalizr.Client.Testing
An in-memory ISignalizrClient for .NET 10/11 tests of signalizr
consumers, without a gateway, Signal account or network connection.
Installation
dotnet add package CasCap.Signalizr.Client.Testing
Reference it from test projects only, and match its version to CasCap.Signalizr.Client.
Purpose
FakeSignalizrClient implements the full client contract in memory. A test feeds inbound
deliveries to the consumer's subscription, then asserts on every group operation the consumer
performed. There is no network, gRPC channel or Signal account involved.
Target frameworks: net10.0, net11.0
Public Surface
FakeSignalizrClient lives in the CasCap.Signalizr.Client.Testing namespace.
| Member | Purpose |
|---|---|
Groups |
Groups returned by GetGroupsAsync; empty by default |
Enqueue(message) |
Queues an inbound delivery for SubscribeAsync |
Complete() |
Ends the subscription cleanly, as a gateway restart would |
Attachments |
Bytes served by GetAttachmentAsync; an unknown identifier fails with a 404 HttpRequestException |
Sent, SentTo(group) |
Messages sent, with their attachments |
Reactions, RemovedReactions, ReactionCount(emoji) |
Reactions set and removed |
Polls, ClosedPolls |
Polls created and closed |
AttachmentFetches |
Attachment identifiers requested |
SubscribeCallCount, StartTypingCallCount, StopTypingCallCount, GetGroupsCallCount |
Call counters |
BlockStartTyping(), ReleaseStartTyping() |
Hold callers inside StartTypingAsync, for example to observe reply-queue backpressure |
GroupsFailures |
The number of upcoming GetGroupsAsync calls that fail with HttpRequestException, as if the gateway were unreachable |
InteractionFailure |
When set, reaction and typing calls fail with this exception instead of being recorded |
Returned timestamps and poll identifiers come from the optional TimeProvider constructor
argument, so a fake clock gives deterministic values. Reacting to a delivery that has no
GroupName throws ArgumentException, matching the real client.
Usage
using CasCap.Signalizr.Client;
using CasCap.Signalizr.Client.Testing;
var signalizr = new FakeSignalizrClient { Groups = ["My Test Group Name"] };
signalizr.Enqueue(new SignalizrMessage
{
DeliveryId = "d1",
GroupName = "My Test Group Name",
Sender = "+10000000001",
Message = "status?",
Timestamp = 1,
});
signalizr.Complete();
await foreach (var message in signalizr.SubscribeAsync(cancellationToken))
await signalizr.SendAsync(message.GroupName!, "Test reply", cancellationToken);
var reply = Xunit.Assert.Single(signalizr.SentTo("My Test Group Name"));
Xunit.Assert.Equal("Test reply", reply.Message);
In a consumer test, register the fake as ISignalizrClient before starting your application fixture,
then assert on its recorded operations. The example above demonstrates the fake's queue and recording
without starting an application.
Limits
The fake does not model durable cursors, acknowledgement timeouts, retention, automatic reconnects
or Signal send validation. Complete() permanently closes its queue after queued deliveries drain;
later subscriptions end immediately. Use the gateway's
source test guide
for coverage of the real delivery contract.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- CasCap.Signalizr.Client (>= 1.3.0)
-
net11.0
- CasCap.Signalizr.Client (>= 1.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.