// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Connections; using Microsoft.AspNetCore.SignalR.Client; namespace Microsoft.AspNetCore.SignalR.Tests { public class DelegateConnectionFactory : IConnectionFactory { private readonly Func> _connectDelegate; private readonly Func _disposeDelegate; public DelegateConnectionFactory(Func> connectDelegate, Func disposeDelegate) { _connectDelegate = connectDelegate; _disposeDelegate = disposeDelegate; } public Task ConnectAsync(TransferFormat transferFormat) { return _connectDelegate(transferFormat); } public Task DisposeAsync(ConnectionContext connection) { return _disposeDelegate(connection); } } }