diff --git a/docfx/logging.md b/docfx/logging.md index e4e6af0a6..d2381bbb6 100644 --- a/docfx/logging.md +++ b/docfx/logging.md @@ -1,7 +1,31 @@ Logging ================= -SSH.NET uses the [Microsoft.Extensions.Logging](https://learn.microsoft.com/dotnet/core/extensions/logging) API to log diagnostic messages. In order to access the log messages of SSH.NET in your own application for diagnosis, register your own `ILoggerFactory` before using the SSH.NET APIs, for example: +SSH.NET uses the [Microsoft.Extensions.Logging](https://learn.microsoft.com/dotnet/core/extensions/logging) API to log diagnostic messages. + +It is possible to specify a logger in the `ConnectionInfo`, for example: + +```cs +using Microsoft.Extensions.Logging; + +ILoggerFactory loggerFactory = LoggerFactory.Create(builder => +{ + builder.SetMinimumLevel(LogLevel.Debug); + builder.AddConsole(); +}); + +var connectionInfo = new ConnectionInfo("sftp.foo.com", + "guest", + new PasswordAuthenticationMethod("guest", "pwd")); + +connectionInfo.LoggerFactory = loggerFactory; +using (var client = new SftpClient(connectionInfo)) +{ + client.Connect(); +} +``` + +You can also register an application-wide `ILoggerFactory` before using the SSH.NET APIs, this will be used as a fallback if the `ConnectionInfo` is not set, for example: ```cs using Microsoft.Extensions.Logging; diff --git a/src/Renci.SshNet/BaseClient.cs b/src/Renci.SshNet/BaseClient.cs index d799ababb..4b0850b15 100644 --- a/src/Renci.SshNet/BaseClient.cs +++ b/src/Renci.SshNet/BaseClient.cs @@ -192,7 +192,7 @@ private protected BaseClient(ConnectionInfo connectionInfo, bool ownsConnectionI _connectionInfo = connectionInfo; _ownsConnectionInfo = ownsConnectionInfo; _serviceFactory = serviceFactory; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(GetType()); + _logger = (connectionInfo.LoggerFactory ?? SshNetLoggingConfiguration.LoggerFactory).CreateLogger(GetType()); _keepAliveInterval = Timeout.InfiniteTimeSpan; } diff --git a/src/Renci.SshNet/Channels/Channel.cs b/src/Renci.SshNet/Channels/Channel.cs index 29a50652a..520ab48fe 100644 --- a/src/Renci.SshNet/Channels/Channel.cs +++ b/src/Renci.SshNet/Channels/Channel.cs @@ -84,7 +84,7 @@ protected Channel(ISession session, uint localChannelNumber, uint localWindowSiz LocalChannelNumber = localChannelNumber; LocalPacketSize = localPacketSize; LocalWindowSize = localWindowSize; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(GetType()); + _logger = session.SessionLoggerFactory.CreateLogger(GetType()); session.ChannelWindowAdjustReceived += OnChannelWindowAdjust; session.ChannelDataReceived += OnChannelData; diff --git a/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs b/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs index 140e5d6e8..2e2c7527e 100644 --- a/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs +++ b/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs @@ -33,7 +33,7 @@ internal sealed class ChannelDirectTcpip : ClientChannel, IChannelDirectTcpip public ChannelDirectTcpip(ISession session, uint localChannelNumber, uint localWindowSize, uint localPacketSize) : base(session, localChannelNumber, localWindowSize, localPacketSize) { - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); + _logger = session.SessionLoggerFactory.CreateLogger(); } /// diff --git a/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs b/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs index 18d5e2b49..1f536ff27 100644 --- a/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs +++ b/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs @@ -48,7 +48,7 @@ internal ChannelForwardedTcpip(ISession session, remoteWindowSize, remotePacketSize) { - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); + _logger = session.SessionLoggerFactory.CreateLogger(); } /// diff --git a/src/Renci.SshNet/Connection/ConnectorBase.cs b/src/Renci.SshNet/Connection/ConnectorBase.cs index ebea9aa80..0816967b6 100644 --- a/src/Renci.SshNet/Connection/ConnectorBase.cs +++ b/src/Renci.SshNet/Connection/ConnectorBase.cs @@ -16,12 +16,12 @@ internal abstract class ConnectorBase : IConnector { private readonly ILogger _logger; - protected ConnectorBase(ISocketFactory socketFactory) + protected ConnectorBase(ISocketFactory socketFactory, ILoggerFactory loggerFactory) { ThrowHelper.ThrowIfNull(socketFactory); SocketFactory = socketFactory; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(GetType()); + _logger = loggerFactory.CreateLogger(GetType()); } internal ISocketFactory SocketFactory { get; private set; } diff --git a/src/Renci.SshNet/Connection/DirectConnector.cs b/src/Renci.SshNet/Connection/DirectConnector.cs index bf6db0d73..4bb459fb3 100644 --- a/src/Renci.SshNet/Connection/DirectConnector.cs +++ b/src/Renci.SshNet/Connection/DirectConnector.cs @@ -2,12 +2,14 @@ using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging; + namespace Renci.SshNet.Connection { internal sealed class DirectConnector : ConnectorBase { - public DirectConnector(ISocketFactory socketFactory) - : base(socketFactory) + public DirectConnector(ISocketFactory socketFactory, ILoggerFactory loggerFactory) + : base(socketFactory, loggerFactory) { } diff --git a/src/Renci.SshNet/Connection/HttpConnector.cs b/src/Renci.SshNet/Connection/HttpConnector.cs index 76bb79c08..063562f8a 100644 --- a/src/Renci.SshNet/Connection/HttpConnector.cs +++ b/src/Renci.SshNet/Connection/HttpConnector.cs @@ -5,6 +5,8 @@ using System.Net.Sockets; using System.Text.RegularExpressions; +using Microsoft.Extensions.Logging; + using Renci.SshNet.Abstractions; using Renci.SshNet.Common; @@ -48,8 +50,8 @@ internal sealed partial class HttpConnector : ProxyConnector private static readonly Regex HttpHeaderRegex = new Regex(HttpHeaderPattern, RegexOptions.Compiled); #endif - public HttpConnector(ISocketFactory socketFactory) - : base(socketFactory) + public HttpConnector(ISocketFactory socketFactory, ILoggerFactory loggerFactory) + : base(socketFactory, loggerFactory) { } diff --git a/src/Renci.SshNet/Connection/ProxyConnector.cs b/src/Renci.SshNet/Connection/ProxyConnector.cs index 03f802a04..6d911e60d 100644 --- a/src/Renci.SshNet/Connection/ProxyConnector.cs +++ b/src/Renci.SshNet/Connection/ProxyConnector.cs @@ -4,6 +4,8 @@ using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; + namespace Renci.SshNet.Connection { /// @@ -12,8 +14,8 @@ namespace Renci.SshNet.Connection /// internal abstract class ProxyConnector : ConnectorBase { - protected ProxyConnector(ISocketFactory socketFactory) - : base(socketFactory) + protected ProxyConnector(ISocketFactory socketFactory, ILoggerFactory loggerFactory) + : base(socketFactory, loggerFactory) { } diff --git a/src/Renci.SshNet/Connection/Socks4Connector.cs b/src/Renci.SshNet/Connection/Socks4Connector.cs index ecc3d3dea..b5ce5e112 100644 --- a/src/Renci.SshNet/Connection/Socks4Connector.cs +++ b/src/Renci.SshNet/Connection/Socks4Connector.cs @@ -4,6 +4,8 @@ using System.Net.Sockets; using System.Text; +using Microsoft.Extensions.Logging; + using Renci.SshNet.Abstractions; using Renci.SshNet.Common; @@ -17,8 +19,8 @@ namespace Renci.SshNet.Connection /// internal sealed class Socks4Connector : ProxyConnector { - public Socks4Connector(ISocketFactory socketFactory) - : base(socketFactory) + public Socks4Connector(ISocketFactory socketFactory, ILoggerFactory loggerFactory) + : base(socketFactory, loggerFactory) { } diff --git a/src/Renci.SshNet/Connection/Socks5Connector.cs b/src/Renci.SshNet/Connection/Socks5Connector.cs index bf54c2285..66a177915 100644 --- a/src/Renci.SshNet/Connection/Socks5Connector.cs +++ b/src/Renci.SshNet/Connection/Socks5Connector.cs @@ -5,6 +5,8 @@ using System.Net.Sockets; using System.Text; +using Microsoft.Extensions.Logging; + using Renci.SshNet.Abstractions; using Renci.SshNet.Common; @@ -18,8 +20,8 @@ namespace Renci.SshNet.Connection /// internal sealed class Socks5Connector : ProxyConnector { - public Socks5Connector(ISocketFactory socketFactory) - : base(socketFactory) + public Socks5Connector(ISocketFactory socketFactory, ILoggerFactory loggerFactory) + : base(socketFactory, loggerFactory) { } diff --git a/src/Renci.SshNet/ConnectionInfo.cs b/src/Renci.SshNet/ConnectionInfo.cs index dce02ada2..fea2b6340 100644 --- a/src/Renci.SshNet/ConnectionInfo.cs +++ b/src/Renci.SshNet/ConnectionInfo.cs @@ -5,6 +5,8 @@ using System.Security.Cryptography; using System.Text; +using Microsoft.Extensions.Logging; + using Renci.SshNet.Common; using Renci.SshNet.Compression; using Renci.SshNet.Messages.Authentication; @@ -495,5 +497,13 @@ IList IConnectionInfoInternal.AuthenticationMethods get { return AuthenticationMethods.Cast().ToList(); } #pragma warning restore S2365 // Properties should not make collection or array copies } + + /// + /// Gets or sets logger factory for this connection. + /// + /// + /// The logger factory for this connection. If then is used. + /// + public ILoggerFactory LoggerFactory { get; set; } } } diff --git a/src/Renci.SshNet/ForwardedPortDynamic.cs b/src/Renci.SshNet/ForwardedPortDynamic.cs index b86506c9d..72045e4c6 100644 --- a/src/Renci.SshNet/ForwardedPortDynamic.cs +++ b/src/Renci.SshNet/ForwardedPortDynamic.cs @@ -21,7 +21,6 @@ namespace Renci.SshNet /// public class ForwardedPortDynamic : ForwardedPort { - private readonly ILogger _logger; private ForwardedPortStatus _status; /// @@ -75,7 +74,6 @@ public ForwardedPortDynamic(string host, uint port) BoundHost = host; BoundPort = port; _status = ForwardedPortStatus.Stopped; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); } /// @@ -416,7 +414,12 @@ private void InternalStop(TimeSpan timeout) if (!_pendingChannelCountdown.Wait(timeout)) { - _logger.LogInformation("Timeout waiting for pending channels in dynamic forwarded port to close."); + var session = Session; + if (session != null) + { + var logger = session.SessionLoggerFactory.CreateLogger(); + logger.LogInformation("Timeout waiting for pending channels in dynamic forwarded port to close."); + } } } diff --git a/src/Renci.SshNet/ForwardedPortLocal.cs b/src/Renci.SshNet/ForwardedPortLocal.cs index f5d376173..6ee313dfa 100644 --- a/src/Renci.SshNet/ForwardedPortLocal.cs +++ b/src/Renci.SshNet/ForwardedPortLocal.cs @@ -14,7 +14,6 @@ namespace Renci.SshNet /// public partial class ForwardedPortLocal : ForwardedPort { - private readonly ILogger _logger; private ForwardedPortStatus _status; private bool _isDisposed; private Socket _listener; @@ -103,7 +102,6 @@ public ForwardedPortLocal(string boundHost, uint boundPort, string host, uint po Host = host; Port = port; _status = ForwardedPortStatus.Stopped; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); } /// @@ -390,7 +388,12 @@ private void InternalStop(TimeSpan timeout) if (!_pendingChannelCountdown.Wait(timeout)) { - _logger.LogInformation("Timeout waiting for pending channels in local forwarded port to close."); + var session = Session; + if (session != null) + { + var logger = session.SessionLoggerFactory.CreateLogger(); + logger.LogInformation("Timeout waiting for pending channels in local forwarded port to close."); + } } } diff --git a/src/Renci.SshNet/ForwardedPortRemote.cs b/src/Renci.SshNet/ForwardedPortRemote.cs index f51a3d82b..6186f78c1 100644 --- a/src/Renci.SshNet/ForwardedPortRemote.cs +++ b/src/Renci.SshNet/ForwardedPortRemote.cs @@ -16,7 +16,6 @@ namespace Renci.SshNet /// public class ForwardedPortRemote : ForwardedPort { - private readonly ILogger _logger; private ForwardedPortStatus _status; private bool _requestStatus; private EventWaitHandle _globalRequestResponse = new AutoResetEvent(initialState: false); @@ -100,7 +99,6 @@ public ForwardedPortRemote(IPAddress boundHostAddress, uint boundPort, IPAddress HostAddress = hostAddress; Port = port; _status = ForwardedPortStatus.Stopped; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); } /// @@ -212,7 +210,12 @@ protected override void StopPort(TimeSpan timeout) if (!_pendingChannelCountdown.Wait(timeout)) { - _logger.LogInformation("Timeout waiting for pending channels in remote forwarded port to close."); + var session = Session; + if (session != null) + { + var logger = session.SessionLoggerFactory.CreateLogger(); + logger.LogInformation("Timeout waiting for pending channels in remote forwarded port to close."); + } } _status = ForwardedPortStatus.Stopped; diff --git a/src/Renci.SshNet/IConnectionInfo.cs b/src/Renci.SshNet/IConnectionInfo.cs index 35dabcc2f..868292b5b 100644 --- a/src/Renci.SshNet/IConnectionInfo.cs +++ b/src/Renci.SshNet/IConnectionInfo.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -12,6 +14,14 @@ namespace Renci.SshNet /// internal interface IConnectionInfo { + /// + /// Gets the logger factory for this connection. + /// + /// + /// The logger factory for this connection. If then is used. + /// + public ILoggerFactory LoggerFactory { get; } + /// /// Gets the timeout to used when waiting for a server to acknowledge closing a channel. /// diff --git a/src/Renci.SshNet/ISession.cs b/src/Renci.SshNet/ISession.cs index 707d36805..7c40ba915 100644 --- a/src/Renci.SshNet/ISession.cs +++ b/src/Renci.SshNet/ISession.cs @@ -3,6 +3,8 @@ using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages; @@ -22,6 +24,14 @@ internal interface ISession : IDisposable /// The connection info. IConnectionInfo ConnectionInfo { get; } + /// + /// Gets the logger factory for this session. + /// + /// + /// The logger factory for this session. Will never return . + /// + public ILoggerFactory SessionLoggerFactory { get; } + /// /// Gets a value indicating whether the session is connected. /// diff --git a/src/Renci.SshNet/ISubsystemSession.cs b/src/Renci.SshNet/ISubsystemSession.cs index ce9e4f1fe..ed9ccd4b2 100644 --- a/src/Renci.SshNet/ISubsystemSession.cs +++ b/src/Renci.SshNet/ISubsystemSession.cs @@ -1,6 +1,8 @@ using System; using System.Threading; +using Microsoft.Extensions.Logging; + using Renci.SshNet.Common; namespace Renci.SshNet @@ -10,6 +12,14 @@ namespace Renci.SshNet /// internal interface ISubsystemSession : IDisposable { + /// + /// Gets the logger factory for this subsystem session. + /// + /// + /// The logger factory for this connection. Will never return . + /// + public ILoggerFactory SessionLoggerFactory { get; } + /// /// Gets or sets the number of milliseconds to wait for an operation to complete. /// diff --git a/src/Renci.SshNet/Security/KeyExchange.cs b/src/Renci.SshNet/Security/KeyExchange.cs index dc4421560..a8843267f 100644 --- a/src/Renci.SshNet/Security/KeyExchange.cs +++ b/src/Renci.SshNet/Security/KeyExchange.cs @@ -18,7 +18,7 @@ namespace Renci.SshNet.Security /// public abstract class KeyExchange : Algorithm, IKeyExchange { - private readonly ILogger _logger; + private ILogger _logger; private Func _hostKeyAlgorithmFactory; private CipherInfo _clientCipherInfo; private CipherInfo _serverCipherInfo; @@ -69,13 +69,13 @@ public byte[] ExchangeHash /// protected KeyExchange() { - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(GetType()); } /// public virtual void Start(Session session, KeyExchangeInitMessage message, bool sendClientInitMessage) { Session = session; + _logger = Session.SessionLoggerFactory.CreateLogger(GetType()); if (sendClientInitMessage) { diff --git a/src/Renci.SshNet/ServiceFactory.cs b/src/Renci.SshNet/ServiceFactory.cs index 796629079..ab3ae16cb 100644 --- a/src/Renci.SshNet/ServiceFactory.cs +++ b/src/Renci.SshNet/ServiceFactory.cs @@ -26,11 +26,8 @@ internal sealed partial class ServiceFactory : IServiceFactory /// private const int PartialSuccessLimit = 5; - private readonly ILogger _logger; - internal ServiceFactory() { - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); } /// @@ -160,7 +157,7 @@ public ISftpFileReader CreateSftpFileReader(string fileName, ISftpSession sftpSe fileSize = null; maxPendingReads = defaultMaxPendingReads; - _logger.LogInformation(ex, "Failed to obtain size of file. Allowing maximum {MaxPendingReads} pending reads", maxPendingReads); + sftpSession.SessionLoggerFactory.CreateLogger().LogInformation(ex, "Failed to obtain size of file. Allowing maximum {MaxPendingReads} pending reads", maxPendingReads); } return sftpSession.CreateFileReader(handle, sftpSession, chunkSize, maxPendingReads, fileSize); @@ -221,16 +218,18 @@ public IConnector CreateConnector(IConnectionInfo connectionInfo, ISocketFactory ThrowHelper.ThrowIfNull(connectionInfo); ThrowHelper.ThrowIfNull(socketFactory); + var loggerFactory = connectionInfo.LoggerFactory ?? SshNetLoggingConfiguration.LoggerFactory; + switch (connectionInfo.ProxyType) { case ProxyTypes.None: - return new DirectConnector(socketFactory); + return new DirectConnector(socketFactory, loggerFactory); case ProxyTypes.Socks4: - return new Socks4Connector(socketFactory); + return new Socks4Connector(socketFactory, loggerFactory); case ProxyTypes.Socks5: - return new Socks5Connector(socketFactory); + return new Socks5Connector(socketFactory, loggerFactory); case ProxyTypes.Http: - return new HttpConnector(socketFactory); + return new HttpConnector(socketFactory, loggerFactory); default: throw new NotSupportedException(string.Format("ProxyTypes '{0}' is not supported.", connectionInfo.ProxyType)); } diff --git a/src/Renci.SshNet/Session.cs b/src/Renci.SshNet/Session.cs index 3fbdac60c..ec3eac878 100644 --- a/src/Renci.SshNet/Session.cs +++ b/src/Renci.SshNet/Session.cs @@ -352,6 +352,14 @@ public string ClientVersion /// public ConnectionInfo ConnectionInfo { get; private set; } + /// + /// Gets the logger factory for this session. + /// + /// + /// The logger factory for this session. + /// + public ILoggerFactory SessionLoggerFactory { get; } + /// /// Occurs when an error occurred. /// @@ -554,9 +562,10 @@ internal Session(ConnectionInfo connectionInfo, IServiceFactory serviceFactory, ThrowHelper.ThrowIfNull(socketFactory); ConnectionInfo = connectionInfo; + SessionLoggerFactory = connectionInfo.LoggerFactory ?? SshNetLoggingConfiguration.LoggerFactory; _serviceFactory = serviceFactory; _socketFactory = socketFactory; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); + _logger = SessionLoggerFactory.CreateLogger(); _messageListenerCompleted = new ManualResetEvent(initialState: true); } diff --git a/src/Renci.SshNet/Sftp/SftpFileReader.cs b/src/Renci.SshNet/Sftp/SftpFileReader.cs index 3c86fc31b..1f3fe396e 100644 --- a/src/Renci.SshNet/Sftp/SftpFileReader.cs +++ b/src/Renci.SshNet/Sftp/SftpFileReader.cs @@ -71,7 +71,7 @@ public SftpFileReader(byte[] handle, ISftpSession sftpSession, uint chunkSize, i _readAheadCompleted = new ManualResetEvent(initialState: false); _disposingWaitHandle = new ManualResetEvent(initialState: false); _waitHandles = _sftpSession.CreateWaitHandleArray(_disposingWaitHandle, _semaphore.AvailableWaitHandle); - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); + _logger = sftpSession.SessionLoggerFactory.CreateLogger(); StartReadAhead(); } diff --git a/src/Renci.SshNet/SubsystemSession.cs b/src/Renci.SshNet/SubsystemSession.cs index af3044674..ba5fea773 100644 --- a/src/Renci.SshNet/SubsystemSession.cs +++ b/src/Renci.SshNet/SubsystemSession.cs @@ -24,7 +24,7 @@ internal abstract class SubsystemSession : ISubsystemSession private readonly string _subsystemName; private readonly ILogger _logger; - private ISession _session; + private readonly ISession _session; private IChannelSession _channel; private Exception _exception; private EventWaitHandle _errorOccurredWaitHandle = new ManualResetEvent(initialState: false); @@ -72,6 +72,14 @@ public bool IsOpen get { return _channel is not null && _channel.IsOpen; } } + public ILoggerFactory SessionLoggerFactory + { + get + { + return _session.SessionLoggerFactory; + } + } + /// /// Initializes a new instance of the class. /// @@ -86,7 +94,7 @@ protected SubsystemSession(ISession session, string subsystemName, int operation _session = session; _subsystemName = subsystemName; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(GetType()); + _logger = SessionLoggerFactory.CreateLogger(GetType()); OperationTimeout = operationTimeout; } @@ -522,11 +530,6 @@ private void EnsureSessionIsOpen() /// private void UnsubscribeFromSessionEvents(ISession session) { - if (session is null) - { - return; - } - session.Disconnected -= Session_Disconnected; session.ErrorOccured -= Session_ErrorOccurred; } @@ -555,8 +558,6 @@ protected virtual void Dispose(bool disposing) { Disconnect(); - _session = null; - var errorOccurredWaitHandle = _errorOccurredWaitHandle; if (errorOccurredWaitHandle != null) { diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTestBase.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTestBase.cs index d22bfd17d..3a7393ff2 100644 --- a/test/Renci.SshNet.Tests/Classes/BaseClientTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/BaseClientTestBase.cs @@ -1,4 +1,6 @@ -using Moq; +using Microsoft.Extensions.Logging.Abstractions; + +using Moq; using Renci.SshNet.Connection; using Renci.SshNet.Tests.Common; @@ -16,6 +18,7 @@ protected virtual void CreateMocks() ServiceFactoryMock = new Mock(MockBehavior.Strict); SocketFactoryMock = new Mock(MockBehavior.Strict); SessionMock = new Mock(MockBehavior.Strict); + SessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); } protected virtual void SetupData() diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTest_ConnectAsync_Timeout.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTest_ConnectAsync_Timeout.cs index db464b18c..deafc16a2 100644 --- a/test/Renci.SshNet.Tests/Classes/BaseClientTest_ConnectAsync_Timeout.cs +++ b/test/Renci.SshNet.Tests/Classes/BaseClientTest_ConnectAsync_Timeout.cs @@ -2,6 +2,7 @@ using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -23,6 +24,7 @@ public class BaseClientTest_ConnectAsync_Timeout public void Init() { var sessionMock = new Mock(); + sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); var serviceFactoryMock = new Mock(); var socketFactoryMock = new Mock(); diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_Connect.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_Connect.cs index 79665089d..714d566b6 100644 --- a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_Connect.cs +++ b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_Connect.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -25,6 +26,7 @@ protected override void CreateMocks() _socketFactory2Mock = new Mock(MockBehavior.Strict); _session2Mock = new Mock(MockBehavior.Strict); + _session2Mock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs index ab15e7e29..7c5b6d10f 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs @@ -4,6 +4,7 @@ using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -49,6 +50,7 @@ protected override void OnInit() _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _forwardedPortMock = new Mock(MockBehavior.Strict); _connectionInfoMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs index ae7abed92..332f3cfe7 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs @@ -4,6 +4,7 @@ using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -78,6 +79,7 @@ private void Arrange() _remotePacketSize = (uint)random.Next(100, 200); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _forwardedPortMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelForwardedTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelForwardedTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs index 8eab76554..8617aba37 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelForwardedTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelForwardedTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs @@ -4,6 +4,7 @@ using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -83,6 +84,7 @@ private void Arrange() _remoteEndpoint = new IPEndPoint(IPAddress.Loopback, 8122); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _forwardedPortMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTestBase.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTestBase.cs index 302f5d39f..f1e8c9ce2 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTestBase.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -21,6 +22,7 @@ public void Initialize() protected void CreateMocks() { SessionMock = new Mock(MockBehavior.Strict); + SessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); ConnectionInfoMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTestBase.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTestBase.cs index e8f1aba2b..221909aa4 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTestBase.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -21,6 +22,7 @@ public void Initialize() protected void CreateMocks() { SessionMock = new Mock(MockBehavior.Strict); + SessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); ConnectionInfoMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenConfirmationReceived_OnOpenConfirmation_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenConfirmationReceived_OnOpenConfirmation_Exception.cs index 0f0ec607d..123cf9a90 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenConfirmationReceived_OnOpenConfirmation_Exception.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenConfirmationReceived_OnOpenConfirmation_Exception.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -40,6 +41,7 @@ private void Arrange() _channelExceptionRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channel = new ClientChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize); _channel.Exception += (sender, args) => _channelExceptionRegister.Add(args); diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenFailureReceived_OnOpenFailure_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenFailureReceived_OnOpenFailure_Exception.cs index 1a76ef5ac..20082a6a9 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenFailureReceived_OnOpenFailure_Exception.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenFailureReceived_OnOpenFailure_Exception.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -38,6 +39,7 @@ private void Arrange() _channelExceptionRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channel = new ClientChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize); _channel.Exception += (sender, args) => _channelExceptionRegister.Add(args); diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTestBase.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTestBase.cs index 9a4707b13..0da8641c0 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTestBase.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -22,6 +23,7 @@ protected void CreateMocks() { ConnectionInfoMock = new Mock(MockBehavior.Strict); SessionMock = new Mock(MockBehavior.Strict); + SessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); NoneAuthenticationMethodMock = new Mock(MockBehavior.Strict); PasswordAuthenticationMethodMock = new Mock(MockBehavior.Strict); PublicKeyAuthenticationMethodMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTestBase.cs b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTestBase.cs index 7eb9040e9..d0d39fdad 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTestBase.cs @@ -1,4 +1,6 @@ -using Moq; +using Microsoft.Extensions.Logging.Abstractions; + +using Moq; using Renci.SshNet.Connection; using Renci.SshNet.Tests.Common; @@ -18,7 +20,7 @@ protected virtual void CreateMocks() protected virtual void SetupData() { - Connector = new DirectConnector(SocketFactoryMock.Object); + Connector = new DirectConnector(SocketFactoryMock.Object, NullLoggerFactory.Instance); SocketFactory = new SocketFactory(); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTestBase.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTestBase.cs index 7023901fa..c8ecb14b4 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTestBase.cs @@ -1,4 +1,6 @@ -using Moq; +using Microsoft.Extensions.Logging.Abstractions; + +using Moq; using Renci.SshNet.Connection; using Renci.SshNet.Tests.Common; @@ -18,7 +20,7 @@ protected virtual void CreateMocks() protected virtual void SetupData() { - Connector = new HttpConnector(SocketFactoryMock.Object); + Connector = new HttpConnector(SocketFactoryMock.Object, NullLoggerFactory.Instance); SocketFactory = new SocketFactory(); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTestBase.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTestBase.cs index ced3e1551..38c6e507a 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTestBase.cs @@ -1,5 +1,7 @@ using System.Net; +using Microsoft.Extensions.Logging.Abstractions; + using Moq; using Renci.SshNet.Connection; @@ -20,7 +22,7 @@ protected virtual void CreateMocks() protected virtual void SetupData() { - Connector = new Socks4Connector(SocketFactoryMock.Object); + Connector = new Socks4Connector(SocketFactoryMock.Object, NullLoggerFactory.Instance); SocketFactory = new SocketFactory(); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs index 24809f614..c5c664e2a 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs @@ -2,6 +2,8 @@ using System.Net; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; + using Moq; using Renci.SshNet.Connection; @@ -22,7 +24,7 @@ protected virtual void CreateMocks() protected virtual void SetupData() { - Connector = new Socks5Connector(SocketFactoryMock.Object); + Connector = new Socks5Connector(SocketFactoryMock.Object, NullLoggerFactory.Instance); SocketFactory = new SocketFactory(); } diff --git a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Failure.cs b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Failure.cs index a06350f72..1b53b67ab 100644 --- a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Failure.cs +++ b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Failure.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -29,6 +30,7 @@ protected void Arrange() _serviceFactoryMock = new Mock(MockBehavior.Strict); _clientAuthenticationMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfo = new ConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, ProxyTypes.None, Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD, diff --git a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Success.cs b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Success.cs index f2309785d..0c87eda6e 100644 --- a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Success.cs +++ b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Success.cs @@ -1,4 +1,5 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -26,6 +27,7 @@ protected void Arrange() _serviceFactoryMock = new Mock(MockBehavior.Strict); _clientAuthenticationMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfo = new ConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, ProxyTypes.None, Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD, diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs index dfd07a273..a9ce2b49e 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -46,6 +47,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs index 64f2ab371..692afe88d 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -71,6 +72,7 @@ private void CreateMocks() { _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs index fb148f66e..5804f6db1 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs @@ -5,6 +5,7 @@ using System.Runtime.InteropServices; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -57,6 +58,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs index 5e8d9c3e2..85ef70f8b 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -46,6 +47,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs index af699acc9..c98784edd 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -72,6 +73,7 @@ private void CreateMocks() { _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs index 0bdb35cd9..adc55951d 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -48,6 +49,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs index e7c115485..d39263b5b 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -49,6 +50,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs index ea869931f..ad71d804c 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -48,6 +49,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs index b873df284..ac2211cdc 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -47,6 +48,7 @@ protected void Arrange() _endpoint = new IPEndPoint(IPAddress.Loopback, 8122); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock.Setup(p => p.IsConnected).Returns(false); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs index a5e1b796c..e58bf3d9c 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs @@ -4,6 +4,7 @@ using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -84,6 +85,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _connectionInfoMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs index 9c15f0798..d28c311b2 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs @@ -4,6 +4,7 @@ using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -68,6 +69,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _connectionInfoMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs index 2ade89d8f..fcfc88a0f 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -70,6 +71,7 @@ private void CreateMocks() { _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs index ed6301e72..fa716b6b3 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs @@ -5,6 +5,7 @@ using System.Runtime.InteropServices; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -57,6 +58,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _ = _connectionInfoMock.Setup(p => p.Timeout) diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs index 2c5c50973..dbc738801 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -46,6 +47,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs index 8b4a837d1..66cc6d57f 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Net; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -42,6 +43,7 @@ protected void Arrange() _exceptionRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs index c45f26612..22a1ae9fe 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -51,6 +52,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs index 3b28f5387..6980d3661 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs @@ -4,6 +4,7 @@ using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -75,6 +76,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs index d25ba1f72..0f3b0a57c 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs index 5975536b5..a9dacf9a6 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -51,6 +52,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs index 361c7e75f..9d003ff12 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _ = _connectionInfoMock.Setup(p => p.Timeout) diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs index 1af1f7e6c..60718f7b3 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _ = _connectionInfoMock.Setup(p => p.Timeout) diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs index 0c169b1bb..c7d13ec38 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _ = _connectionInfoMock.Setup(p => p.Timeout) diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs index 0f8462e0f..9887f7d50 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ protected void Arrange() random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock.Setup(p => p.IsConnected).Returns(false); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs index d6e9ca4b1..06c288458 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -51,6 +52,7 @@ protected void Arrange() random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock.Setup(p => p.IsConnected).Returns(false); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs index 17b6c11bb..3b2c4a1d4 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -51,6 +52,7 @@ protected void Arrange() random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs index 47d1acd80..a6432f38a 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs @@ -4,6 +4,7 @@ using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -65,6 +66,7 @@ private void CreateMocks() { _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs index 10fa71582..b8e893db0 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs index 31b383a17..7ec8bde32 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs @@ -3,6 +3,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -50,6 +51,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs index 3f6c7edf2..37f526e40 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs @@ -3,6 +3,7 @@ using System.Globalization; using System.Net; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs index 07f092201..eea751b13 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs @@ -4,6 +4,7 @@ using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -71,6 +72,7 @@ private void CreateMocks() { _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs index 6a12103f1..ecb1a2ac2 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs @@ -4,6 +4,7 @@ using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -54,6 +55,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs index 8fecf98c8..ede0df79d 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs @@ -4,6 +4,7 @@ using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -61,6 +62,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs index 6c5c0cc62..386da0130 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs @@ -4,6 +4,7 @@ using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -62,6 +63,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs index 9e056da77..b952bad9e 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs @@ -4,6 +4,7 @@ using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -61,6 +62,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs index 21202686b..681bffb0b 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs @@ -3,6 +3,7 @@ using System.Globalization; using System.Net; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -56,6 +57,7 @@ protected void Arrange() _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _ = _sessionMock.Setup(p => p.IsConnected) diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs index 649848ba1..5fe0ee302 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs @@ -4,6 +4,7 @@ using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -59,6 +60,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs index 979431901..a95c54ca1 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs @@ -4,6 +4,7 @@ using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -61,6 +62,7 @@ protected void Arrange() _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(15)); _sessionMock.Setup(p => p.IsConnected).Returns(true); diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs index 56c5eeb07..8d33af3e2 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs @@ -1,5 +1,6 @@ using System; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -20,6 +21,7 @@ public void Setup() { _serviceFactory = new ServiceFactory(); _connectionInfoMock = new Mock(MockBehavior.Strict); + _connectionInfoMock.Setup(p => p.LoggerFactory).Returns(NullLoggerFactory.Instance); _socketFactoryMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs index ce5c7b04d..77e226b3c 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs @@ -1,5 +1,6 @@ using System; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -39,6 +40,7 @@ private void SetupData() private void CreateMocks() { _sftpSessionMock = new Mock(MockBehavior.Strict); + _sftpSessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _sftpFileReaderMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs index 041359311..21e7a187b 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -44,6 +45,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs index c9a978295..c724eea84 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -41,6 +42,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs index fb3a8f3cb..e92023829 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -44,6 +45,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs index 269eb28bc..79c928cf6 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -41,6 +42,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs index 8f9595412..ae7242810 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -43,6 +44,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs index de06ca46c..c690c3a5a 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -40,6 +41,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs index 6cb082b4b..24291fe73 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs @@ -6,6 +6,7 @@ using System.Security.Cryptography; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -173,7 +174,7 @@ protected virtual void SetupData() }; ServerListener.Start(); - ClientSocket = new DirectConnector(_socketFactory).Connect(ConnectionInfo); + ClientSocket = new DirectConnector(_socketFactory, NullLoggerFactory.Instance).Connect(ConnectionInfo); void SendKeyExchangeInit() { diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs index 5bb6c1511..9114ae151 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs @@ -5,6 +5,7 @@ using System.Net.Sockets; using System.Security.Cryptography; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -132,7 +133,7 @@ protected virtual void SetupData() ServerListener.Start(); - ClientSocket = new DirectConnector(_socketFactory).Connect(ConnectionInfo); + ClientSocket = new DirectConnector(_socketFactory, NullLoggerFactory.Instance).Connect(ConnectionInfo); } private void CreateMocks() diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectingBase.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectingBase.cs index 4da2ef1ee..e8bb7bd7d 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectingBase.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectingBase.cs @@ -5,6 +5,7 @@ using System.Net.Sockets; using System.Security.Cryptography; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -199,7 +200,7 @@ protected virtual void SetupData() }; ServerListener.Start(); - ClientSocket = new DirectConnector(_socketFactory).Connect(ConnectionInfo); + ClientSocket = new DirectConnector(_socketFactory, NullLoggerFactory.Instance).Connect(ConnectionInfo); } private void CreateMocks() diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_SocketConnected_BadPacketAndDispose.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_SocketConnected_BadPacketAndDispose.cs index 5afe3bc0f..b3d75d5c5 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_SocketConnected_BadPacketAndDispose.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_SocketConnected_BadPacketAndDispose.cs @@ -2,6 +2,7 @@ using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -78,7 +79,7 @@ protected void SetupData() _session = new Session(_connectionInfo, _serviceFactoryMock.Object, _socketFactoryMock.Object); - _clientSocket = new DirectConnector(_socketFactory).Connect(_connectionInfo); + _clientSocket = new DirectConnector(_socketFactory, NullLoggerFactory.Instance).Connect(_connectionInfo); } protected void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTestBase.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTestBase.cs index eed1c71cc..c48836ba5 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTestBase.cs @@ -1,6 +1,7 @@ using System; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -19,6 +20,7 @@ public abstract class SftpFileReaderTestBase protected void CreateMocks() { SftpSessionMock = new Mock(MockBehavior.Strict); + SftpSessionMock.Setup(s => s.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); } protected abstract void SetupMocks(); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs index fea017d0b..50125eb7f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs @@ -2,6 +2,7 @@ using System.Linq; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -98,6 +99,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs index d2f03f676..a80c744d9 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs @@ -1,6 +1,7 @@ using System; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -91,6 +92,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs index eda2fc79f..45bf5c020 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs @@ -1,6 +1,7 @@ using System; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -113,6 +114,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelSessionMock = new Mock(MockBehavior.Strict); _sftpResponseFactoryMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs index 77b0c42ec..e0e809af8 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs @@ -1,6 +1,7 @@ using System; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -113,6 +114,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelSessionMock = new Mock(MockBehavior.Strict); _sftpResponseFactoryMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs index 46dca30a4..88aad7e6b 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs @@ -1,6 +1,7 @@ using System; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -96,6 +97,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelSessionMock = new Mock(MockBehavior.Strict); _sftpResponseFactoryMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest.UploadFile.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest.UploadFile.cs index 5bb4c916e..38a4b85e0 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest.UploadFile.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest.UploadFile.cs @@ -4,6 +4,8 @@ using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -173,6 +175,8 @@ public void SendMessage(Message message) public WaitHandle MessageListenerCompleted => throw new NotImplementedException(); + public ILoggerFactory SessionLoggerFactory => NullLoggerFactory.Instance; + public void Connect() { } diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest_AsyncExceptions.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest_AsyncExceptions.cs index e308cac18..e138200a6 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest_AsyncExceptions.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest_AsyncExceptions.cs @@ -4,6 +4,8 @@ using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -216,6 +218,8 @@ public void SendMessage(Message message) public WaitHandle MessageListenerCompleted => throw new NotImplementedException(); + public ILoggerFactory SessionLoggerFactory => NullLoggerFactory.Instance; + public void Connect() { } diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs index 37fda2b88..4e1f4f3fc 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs @@ -4,6 +4,7 @@ using System.Text; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -47,6 +48,7 @@ protected override void OnInit() _encoding = Encoding.UTF8; _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_ReadExpect.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_ReadExpect.cs index 3a9d26fcb..acd903037 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_ReadExpect.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_ReadExpect.cs @@ -5,6 +5,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -32,6 +33,7 @@ public void Initialize() connectionInfoMock.Setup(p => p.Encoding).Returns(Encoding.UTF8); var sessionMock = new Mock(); + sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); sessionMock.Setup(p => p.ConnectionInfo).Returns(connectionInfoMock.Object); sessionMock.Setup(p => p.CreateChannelSession()).Returns(_channelSessionStub); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs index 997863cf4..977f47817 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -65,6 +66,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs index 20968486a..e14dcc106 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -59,6 +60,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs index 94d55ca87..516eca629 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -58,6 +59,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs index 680c4140a..08ec7a654 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -61,6 +62,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs index 194af3c69..c5928291f 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -61,6 +62,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs index ac8c38477..f4739bd2e 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -61,6 +62,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs index f0622ccf3..30de20fb5 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -67,6 +68,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs index bc094dc57..23c82bfc0 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -61,6 +62,7 @@ private void SetupData() private void CreateMocks() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _connectionInfoMock = new Mock(MockBehavior.Strict); _channelSessionMock = new Mock(MockBehavior.Strict); } diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs index a65716514..bff51de39 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -109,6 +110,7 @@ public void CreateShellStreamShouldReturnValueReturnedByCreateShellStreamOnServi private ShellStream CreateShellStream() { var sessionMock = new Mock(MockBehavior.Loose); + sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); var channelSessionMock = new Mock(MockBehavior.Strict); sessionMock.Setup(p => p.ConnectionInfo) diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs index 861c8c725..2733997c9 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs @@ -1,5 +1,6 @@ using System; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -104,6 +105,7 @@ public void CreateShellStreamShouldReturnValueReturnedByCreateShellStreamOnServi private ShellStream CreateShellStream() { var sessionMock = new Mock(MockBehavior.Loose); + sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); var channelSessionMock = new Mock(MockBehavior.Strict); _ = sessionMock.Setup(p => p.ConnectionInfo) diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteInvokedOnAsyncResultFromPreviousInvocation.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteInvokedOnAsyncResultFromPreviousInvocation.cs index eff6e30aa..676cec5f6 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteInvokedOnAsyncResultFromPreviousInvocation.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteInvokedOnAsyncResultFromPreviousInvocation.cs @@ -2,6 +2,7 @@ using System.Globalization; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -37,6 +38,7 @@ private void Arrange() var random = new Random(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelSessionAMock = new Mock(MockBehavior.Strict); _channelSessionBMock = new Mock(MockBehavior.Strict); _commandText = random.Next().ToString(CultureInfo.InvariantCulture); diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteNotInvokedOnAsyncResultFromPreviousInvocation.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteNotInvokedOnAsyncResultFromPreviousInvocation.cs index f968eb006..49efb4eae 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteNotInvokedOnAsyncResultFromPreviousInvocation.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteNotInvokedOnAsyncResultFromPreviousInvocation.cs @@ -2,6 +2,7 @@ using System.Globalization; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -34,6 +35,7 @@ private void Arrange() var random = new Random(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelSessionMock = new Mock(MockBehavior.Strict); _commandText = random.Next().ToString(CultureInfo.InvariantCulture); _encoding = Encoding.UTF8; diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_Dispose.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_Dispose.cs index 217ab84e7..60804ee63 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_Dispose.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_Dispose.cs @@ -3,6 +3,7 @@ using System.IO; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -35,6 +36,7 @@ protected override void OnInit() private void Arrange() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _commandText = new Random().Next().ToString(CultureInfo.InvariantCulture); _encoding = Encoding.UTF8; _channelSessionMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultFromOtherInstance.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultFromOtherInstance.cs index 79de6bb21..89398051f 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultFromOtherInstance.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultFromOtherInstance.cs @@ -2,6 +2,7 @@ using System.Globalization; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -35,6 +36,7 @@ protected override void OnInit() private void Arrange() { _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelSessionAMock = new Mock(MockBehavior.Strict); _channelSessionBMock = new Mock(MockBehavior.Strict); _commandText = new Random().Next().ToString(CultureInfo.InvariantCulture); diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultIsNull.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultIsNull.cs index bb997b28a..8105fa0e4 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultIsNull.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultIsNull.cs @@ -2,6 +2,7 @@ using System.Globalization; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -31,6 +32,7 @@ protected override void OnInit() private void Arrange() { _sessionMock = new Mock(); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _commandText = new Random().Next().ToString(CultureInfo.InvariantCulture); _encoding = Encoding.UTF8; _asyncResult = null; diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs index 1afc92234..af8a9f56e 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs @@ -2,6 +2,7 @@ using System.Globalization; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -42,6 +43,7 @@ private void Arrange() var random = new Random(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelSessionMock = new Mock(MockBehavior.Strict); _commandText = random.Next().ToString(CultureInfo.InvariantCulture); _encoding = Encoding.UTF8; diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs index 238b277a9..7496a03a1 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -40,6 +41,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disconnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disconnected.cs index 273ceef45..af31b6a5f 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disconnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disconnected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -40,6 +41,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelBeforeDisconnectMock = new Mock(MockBehavior.Strict); _channelAfterDisconnectMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs index 5f538bc33..8d844788e 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -39,6 +40,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs index 8e5a7b5fd..89580f90b 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -40,6 +41,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Connected.cs index bf1b3b789..a78fd44f7 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Connected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -39,6 +40,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Disposed.cs index 4ee558c3b..a375e4376 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Disposed.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -38,6 +39,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_NeverConnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_NeverConnected.cs index a7edaf9f6..ddfde8d92 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_NeverConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_NeverConnected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -36,6 +37,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _subsystemSession = new SubsystemSessionStub(_sessionMock.Object, _subsystemName, diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Connected.cs index 3de5b14a7..b25bad65e 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Connected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -38,6 +39,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disconnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disconnected.cs index eaae69dc0..c6aba3ce4 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disconnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disconnected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -38,6 +39,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disposed.cs index e0da36780..5eb881f5d 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disposed.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -38,6 +39,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_NeverConnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_NeverConnected.cs index 96e768c9e..17c1c8977 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_NeverConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_NeverConnected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -37,6 +38,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _subsystemSession = new SubsystemSessionStub(_sessionMock.Object, _subsystemName, diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs index 54adb93d9..2629c90fa 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -43,6 +44,7 @@ protected void Arrange() new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs index e34294f9b..fc4b29600 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -42,6 +43,7 @@ protected void Arrange() new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs index bd083f515..7a81fc59c 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -45,6 +46,7 @@ protected void Arrange() _onDataReceivedException = new SystemException(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs index 5ab10b053..7c042c84d 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -42,6 +43,7 @@ protected void Arrange() _channelExceptionEventArgs = new ExceptionEventArgs(new SystemException()); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs index 19df7854f..0f63f1934 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -40,6 +41,7 @@ protected void Arrange() _channelExceptionEventArgs = new ExceptionEventArgs(new SystemException()); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Connected.cs index f689d8017..5d6fbe463 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Connected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -39,6 +40,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs index cd555b47e..c2416ebc5 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -38,6 +39,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs index ebb5b859b..a11764752 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -42,6 +43,7 @@ protected void Arrange() _errorOccurredEventArgs = new ExceptionEventArgs(new SystemException()); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs index 6a7f45665..d3301c03d 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -40,6 +41,7 @@ protected void Arrange() _errorOccurredEventArgs = new ExceptionEventArgs(new SystemException()); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs index 72b95ef87..eac62bb26 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -41,6 +42,7 @@ protected void Arrange() _data = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }; _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs index 121545be1..4fb93ce24 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -39,6 +40,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); var sequence = new MockSequence(); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs index 93af67cb7..3521b22c9 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -42,6 +43,7 @@ protected void Arrange() _data = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }; _sessionMock = new Mock(MockBehavior.Strict); + _sessionMock.Setup(p => p.SessionLoggerFactory).Returns(NullLoggerFactory.Instance); _channelMock = new Mock(MockBehavior.Strict); _sequence = new MockSequence();