[Discussion] [Breaking change]: Unit testing SignalR Hubs may need updating #42326
Closed
1 of 3 tasks
Labels
area-signalr
Includes: SignalR clients and servers
Milestone
Description
IHubClients
andIHubCallerClients
now hide interface membersIClientProxy Client(string connectionId);
andIClientProxy Caller { get; }
withISingleClientProxy Client(string connectionId);
andISingleClientProxy Caller { get; }
in order to add support for client results.This is not a breaking change to production code, unless you use reflection to call the above
Client
orCaller
methods.Version
.NET 7
Previous behavior
When using a testing library like Moq to unit test a SignalR Hub, you may write some code like follows:
New behavior
Type of breaking change
Reason for change
The change was made to add new functionality to SignalR and is non-breaking in normal use cases. The main area we see the change breaking is in test code which is easily updated.
Recommended action
Update test code to use the
ISingleClientProxy
interface when using reflection/reflection-based test code.Affected APIs
IHubClients
andIHubCallerClients
Announcement
aspnet/Announcements#487
The text was updated successfully, but these errors were encountered: