-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-signalrIncludes: SignalR clients and serversIncludes: SignalR clients and servers
Milestone
Description
This came up in the Hub Proxy source generator work, in order to easily test the source generator, we need to be able to mock the HubConnection.
The proposal is to add virtual
to some of the public methods, highlighted below are the ones required for the source generator testing, but we might want to extend it to more of the public methods as well for general testability.
public class HubConnection : IAsyncDisposable
{
Task StartAsync(CancellationToken cancellationToken = default);
Task StopAsync(CancellationToken cancellationToken = default);
ValueTask DisposeAsync();
+ virtual IDisposable On(string methodName, Type[] parameterTypes, Func<object?[], object, Task> handler, object state);
void Remove(string methodName);
+ virtual Task<ChannelReader<object?>> StreamAsChannelCoreAsync(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken = default);
+ virtual Task<object?> InvokeCoreAsync(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken = default);
+ virtual Task SendCoreAsync(string methodName, object?[] args, CancellationToken cancellationToken = default);
+ virtual IAsyncEnumerable<TResult> StreamAsyncCore<TResult>(string methodName, object?[] args, CancellationToken cancellationToken = default);
}
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-signalrIncludes: SignalR clients and serversIncludes: SignalR clients and servers