Files
ssh.net/test/Renci.SshNet.IntegrationTests/LinuxVMConnectionFactory.cs
mus65 c0a353a4de Cleanup formatting and style and enforce it in CI (#1380)
* Preparation to enforce formatting and style in CI

- enabled IDE0055 to enforce formatting on build
- disabled SA1137 and SA1025 because they are already
  covered by IDE0055
- disabled SA1021 because it conflicts with csharp_space_after_cast

* Cleanup formatting and style on codebase

This commit has no manual changes, it is the result
of running "dotnet format whitespace" and "dotnet format style"

* new formatting fixes after merge

* appveyor: set git autocrlf

as suggested by sharwell to hopefully fix Windows CI.

* use autocrlf input

to hopefully fix Linux tests

* fix formatting

* use autocrlf input for Linux only

* set csharp_space_after_cast to false

* Revert SA1021 suppression

---------

Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
2024-05-17 22:34:27 +02:00

63 lines
2.0 KiB
C#

namespace Renci.SshNet.IntegrationTests
{
public class LinuxVMConnectionFactory : IConnectionInfoFactory
{
private const string ProxyHost = "127.0.0.1";
private const int ProxyPort = 1234;
private const string ProxyUserName = "test";
private const string ProxyPassword = "123";
private readonly string _host;
private readonly int _port;
private readonly AuthenticationMethodFactory _authenticationMethodFactory;
public LinuxVMConnectionFactory(string sshServerHostName, ushort sshServerPort)
{
_host = sshServerHostName;
_port = sshServerPort;
_authenticationMethodFactory = new AuthenticationMethodFactory();
}
public LinuxVMConnectionFactory(string sshServerHostName, ushort sshServerPort, AuthenticationMethodFactory authenticationMethodFactory)
{
_host = sshServerHostName;
_port = sshServerPort;
_authenticationMethodFactory = authenticationMethodFactory;
}
public ConnectionInfo Create()
{
return Create(_authenticationMethodFactory.CreateRegularUserPrivateKeyAuthenticationMethod());
}
public ConnectionInfo Create(params AuthenticationMethod[] authenticationMethods)
{
return new ConnectionInfo(_host, _port, Users.Regular.UserName, authenticationMethods);
}
public ConnectionInfo CreateWithProxy()
{
return CreateWithProxy(_authenticationMethodFactory.CreateRegularUserPrivateKeyAuthenticationMethod());
}
public ConnectionInfo CreateWithProxy(params AuthenticationMethod[] authenticationMethods)
{
return new ConnectionInfo(
_host,
_port,
Users.Regular.UserName,
ProxyTypes.Socks4,
ProxyHost,
ProxyPort,
ProxyUserName,
ProxyPassword,
authenticationMethods);
}
}
}