Skip to content

Commit a818ed5

Browse files
Adding OnCreateClient (#551)
Co-authored-by: Deepanshu Vaid <[email protected]>
1 parent c2b8020 commit a818ed5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/VirtualClient/VirtualClient.TestFramework/InMemorySshClientFactory.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace VirtualClient
55
{
6+
using System;
67
using System.Collections.Generic;
78
using Renci.SshNet;
89

@@ -24,10 +25,15 @@ public InMemorySshClientFactory()
2425
/// </summary>
2526
public IEnumerable<ISshClientProxy> SshClients { get; }
2627

28+
/// <summary>
29+
/// Delegate defines logic to execute when the 'CreateClient' method is called.
30+
/// </summary>
31+
public Func<ConnectionInfo, ISshClientProxy> OnCreateClient { get; set; }
32+
2733
/// <inheritdoc />
2834
public ISshClientProxy CreateClient(ConnectionInfo connection)
2935
{
30-
ISshClientProxy sshClient = new InMemorySshClient(connection);
36+
ISshClientProxy sshClient = this.OnCreateClient?.Invoke(connection) ?? new InMemorySshClient(connection);
3137
(this.SshClients as List<ISshClientProxy>).Add(sshClient);
3238

3339
return sshClient;

0 commit comments

Comments
 (0)