diff --git a/docfx/logging.md b/docfx/logging.md index e4e6af0a..d2381bbb 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 d799abab..4b0850b1 100644 --- a/src/Renci.SshNet/BaseClient.cs +++ b/src/Renci.SshNet/BaseClient.cs @@ -192,7 +192,7 @@ namespace Renci.SshNet _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 29a50652..520ab48f 100644 --- a/src/Renci.SshNet/Channels/Channel.cs +++ b/src/Renci.SshNet/Channels/Channel.cs @@ -84,7 +84,7 @@ namespace Renci.SshNet.Channels 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 140e5d6e..2e2c7527 100644 --- a/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs +++ b/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs @@ -33,7 +33,7 @@ namespace Renci.SshNet.Channels 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 18d5e2b4..1f536ff2 100644 --- a/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs +++ b/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs @@ -48,7 +48,7 @@ namespace Renci.SshNet.Channels 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 ebea9aa8..0816967b 100644 --- a/src/Renci.SshNet/Connection/ConnectorBase.cs +++ b/src/Renci.SshNet/Connection/ConnectorBase.cs @@ -16,12 +16,12 @@ namespace Renci.SshNet.Connection { 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 bf6db0d7..4bb459fb 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 76bb79c0..063562f8 100644 --- a/src/Renci.SshNet/Connection/HttpConnector.cs +++ b/src/Renci.SshNet/Connection/HttpConnector.cs @@ -5,6 +5,8 @@ using System.Net; using System.Net.Sockets; using System.Text.RegularExpressions; +using Microsoft.Extensions.Logging; + using Renci.SshNet.Abstractions; using Renci.SshNet.Common; @@ -48,8 +50,8 @@ namespace Renci.SshNet.Connection 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 03f802a0..6d911e60 100644 --- a/src/Renci.SshNet/Connection/ProxyConnector.cs +++ b/src/Renci.SshNet/Connection/ProxyConnector.cs @@ -4,6 +4,8 @@ using System.Net.Sockets; 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 ecc3d3de..b5ce5e11 100644 --- a/src/Renci.SshNet/Connection/Socks4Connector.cs +++ b/src/Renci.SshNet/Connection/Socks4Connector.cs @@ -4,6 +4,8 @@ using System.Net; 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 bf54c228..66a17791 100644 --- a/src/Renci.SshNet/Connection/Socks5Connector.cs +++ b/src/Renci.SshNet/Connection/Socks5Connector.cs @@ -5,6 +5,8 @@ using System.Net; 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 dce02ada..fea2b634 100644 --- a/src/Renci.SshNet/ConnectionInfo.cs +++ b/src/Renci.SshNet/ConnectionInfo.cs @@ -5,6 +5,8 @@ using System.Net; 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 @@ namespace Renci.SshNet 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 b86506c9..72045e4c 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 @@ namespace Renci.SshNet BoundHost = host; BoundPort = port; _status = ForwardedPortStatus.Stopped; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); } /// @@ -416,7 +414,12 @@ namespace Renci.SshNet 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 f5d37617..6ee313df 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 @@ namespace Renci.SshNet Host = host; Port = port; _status = ForwardedPortStatus.Stopped; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); } /// @@ -390,7 +388,12 @@ namespace Renci.SshNet 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 f51a3d82..6186f78c 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 @@ namespace Renci.SshNet HostAddress = hostAddress; Port = port; _status = ForwardedPortStatus.Stopped; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); } /// @@ -212,7 +210,12 @@ namespace Renci.SshNet 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 35dabcc2..868292b5 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 707d3680..7c40ba91 100644 --- a/src/Renci.SshNet/ISession.cs +++ b/src/Renci.SshNet/ISession.cs @@ -3,6 +3,8 @@ using System.Net.Sockets; 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 @@ namespace Renci.SshNet /// 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 ce9e4f1f..ed9ccd4b 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 dc442156..a8843267 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 @@ namespace Renci.SshNet.Security /// 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 79662907..ab3ae16c 100644 --- a/src/Renci.SshNet/ServiceFactory.cs +++ b/src/Renci.SshNet/ServiceFactory.cs @@ -26,11 +26,8 @@ namespace Renci.SshNet /// private const int PartialSuccessLimit = 5; - private readonly ILogger _logger; - internal ServiceFactory() { - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(); } /// @@ -160,7 +157,7 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet 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 3fbdac60..ec3eac87 100644 --- a/src/Renci.SshNet/Session.cs +++ b/src/Renci.SshNet/Session.cs @@ -352,6 +352,14 @@ namespace Renci.SshNet /// 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 @@ namespace Renci.SshNet 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 3c86fc31..1f3fe396 100644 --- a/src/Renci.SshNet/Sftp/SftpFileReader.cs +++ b/src/Renci.SshNet/Sftp/SftpFileReader.cs @@ -71,7 +71,7 @@ namespace Renci.SshNet.Sftp _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 af304467..ba5fea77 100644 --- a/src/Renci.SshNet/SubsystemSession.cs +++ b/src/Renci.SshNet/SubsystemSession.cs @@ -24,7 +24,7 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet _session = session; _subsystemName = subsystemName; - _logger = SshNetLoggingConfiguration.LoggerFactory.CreateLogger(GetType()); + _logger = SessionLoggerFactory.CreateLogger(GetType()); OperationTimeout = operationTimeout; } @@ -522,11 +530,6 @@ namespace Renci.SshNet /// private void UnsubscribeFromSessionEvents(ISession session) { - if (session is null) - { - return; - } - session.Disconnected -= Session_Disconnected; session.ErrorOccured -= Session_ErrorOccurred; } @@ -555,8 +558,6 @@ namespace Renci.SshNet { 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 d22bfd17..3a7393ff 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 @@ namespace Renci.SshNet.Tests.Classes 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 db464b18..deafc16a 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 @@ namespace Renci.SshNet.Tests.Classes 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 79665089..714d566b 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 @@ namespace Renci.SshNet.Tests.Classes _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 ab15e7e2..7c5b6d10 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; using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -49,6 +50,7 @@ namespace Renci.SshNet.Tests.Classes.Channels _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 ae7abed9..332f3cfe 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; using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -78,6 +79,7 @@ namespace Renci.SshNet.Tests.Classes.Channels _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 8eab7655..8617aba3 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; using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -83,6 +84,7 @@ namespace Renci.SshNet.Tests.Classes.Channels _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 302f5d39..f1e8c9ce 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 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 e8f1aba2..221909aa 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 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 0f0ec607..123cf9a9 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 @@ namespace Renci.SshNet.Tests.Classes.Channels _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 1a76ef5a..20082a6a 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 @@ namespace Renci.SshNet.Tests.Classes.Channels _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 9a4707b1..0da8641c 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 @@ namespace Renci.SshNet.Tests.Classes { 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 7eb9040e..d0d39fda 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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 7023901f..c8ecb14b 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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 ced3e155..38c6e507 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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 24809f61..c5c664e2 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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 a06350f7..1b53b67a 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 @@ namespace Renci.SshNet.Tests.Classes _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 f2309785..0c87eda6 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 @@ namespace Renci.SshNet.Tests.Classes _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 dfd07a27..a9ce2b49 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -46,6 +47,7 @@ namespace Renci.SshNet.Tests.Classes _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 64f2ab37..692afe88 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.Net.Sockets; using System.Text; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -71,6 +72,7 @@ namespace Renci.SshNet.Tests.Classes { _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 fb148f66..5804f6db 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.Net.Sockets; using System.Runtime.InteropServices; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -57,6 +58,7 @@ namespace Renci.SshNet.Tests.Classes _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 5e8d9c3e..85ef70f8 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -46,6 +47,7 @@ namespace Renci.SshNet.Tests.Classes _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 af699acc..c98784ed 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.Net.Sockets; using System.Text; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -72,6 +73,7 @@ namespace Renci.SshNet.Tests.Classes { _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 0bdb35cd..adc55951 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -48,6 +49,7 @@ namespace Renci.SshNet.Tests.Classes _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 e7c11548..d39263b5 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -49,6 +50,7 @@ namespace Renci.SshNet.Tests.Classes _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 ea869931..ad71d804 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -48,6 +49,7 @@ namespace Renci.SshNet.Tests.Classes _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 b873df28..ac2211cd 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -47,6 +48,7 @@ namespace Renci.SshNet.Tests.Classes _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 a5e1b796..e58bf3d9 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; using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -84,6 +85,7 @@ namespace Renci.SshNet.Tests.Classes 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 9c15f079..d28c311b 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; using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -68,6 +69,7 @@ namespace Renci.SshNet.Tests.Classes 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 2ade89d8..fcfc88a0 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.Net.Sockets; using System.Text; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -70,6 +71,7 @@ namespace Renci.SshNet.Tests.Classes { _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 ed6301e7..fa716b6b 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.Net.Sockets; using System.Runtime.InteropServices; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -57,6 +58,7 @@ namespace Renci.SshNet.Tests.Classes _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 2c5c5097..dbc73880 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -46,6 +47,7 @@ namespace Renci.SshNet.Tests.Classes _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 8b4a837d..66cc6d57 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 @@ namespace Renci.SshNet.Tests.Classes _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 c45f2661..22a1ae9f 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -51,6 +52,7 @@ namespace Renci.SshNet.Tests.Classes _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 3b28f538..6980d366 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; using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -75,6 +76,7 @@ namespace Renci.SshNet.Tests.Classes _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 d25ba1f7..0f3b0a57 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ namespace Renci.SshNet.Tests.Classes _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 5975536b..a9dacf9a 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -51,6 +52,7 @@ namespace Renci.SshNet.Tests.Classes _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 361c7e75..9d003ff1 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ namespace Renci.SshNet.Tests.Classes _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 1af1f7e6..60718f7b 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ namespace Renci.SshNet.Tests.Classes _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 0c169b1b..c7d13ec3 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ namespace Renci.SshNet.Tests.Classes _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 0f8462e0..9887f7d5 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ namespace Renci.SshNet.Tests.Classes 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 d6e9ca4b..06c28845 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -51,6 +52,7 @@ namespace Renci.SshNet.Tests.Classes 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 17b6c11b..3b2c4a1d 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -51,6 +52,7 @@ namespace Renci.SshNet.Tests.Classes 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 47d1acd8..a6432f38 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; using System.Net.Sockets; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -65,6 +66,7 @@ namespace Renci.SshNet.Tests.Classes { _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 10fa7158..b8e893db 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ namespace Renci.SshNet.Tests.Classes _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 31b383a1..7ec8bde3 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.Collections.Generic; using System.Net; using System.Net.Sockets; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -50,6 +51,7 @@ namespace Renci.SshNet.Tests.Classes _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 3f6c7edf..37f526e4 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.Collections.Generic; using System.Globalization; using System.Net; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -52,6 +53,7 @@ namespace Renci.SshNet.Tests.Classes _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 07f09220..eea751b1 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.Globalization; using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -71,6 +72,7 @@ namespace Renci.SshNet.Tests.Classes { _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 6a12103f..ecb1a2ac 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.Globalization; using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -54,6 +55,7 @@ namespace Renci.SshNet.Tests.Classes _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 8fecf98c..ede0df79 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.Globalization; using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -61,6 +62,7 @@ namespace Renci.SshNet.Tests.Classes _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 6c5c0cc6..386da013 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.Globalization; using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -62,6 +63,7 @@ namespace Renci.SshNet.Tests.Classes _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 9e056da7..b952bad9 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.Globalization; using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -61,6 +62,7 @@ namespace Renci.SshNet.Tests.Classes _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 21202686..681bffb0 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.Collections.Generic; using System.Globalization; using System.Net; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -56,6 +57,7 @@ namespace Renci.SshNet.Tests.Classes _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 649848ba..5fe0ee30 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.Globalization; using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -59,6 +60,7 @@ namespace Renci.SshNet.Tests.Classes _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 97943190..a95c54ca 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.Globalization; using System.Net; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -61,6 +62,7 @@ namespace Renci.SshNet.Tests.Classes _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 56c5eeb0..8d33af3e 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 @@ namespace Renci.SshNet.Tests.Classes { _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 ce5c7b04..77e226b3 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 @@ namespace Renci.SshNet.Tests.Classes 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 04135931..21e7a187 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 @@ namespace Renci.SshNet.Tests.Classes 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 c9a97829..c724eea8 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 @@ namespace Renci.SshNet.Tests.Classes 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 fb3a8f3c..e9202382 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 @@ namespace Renci.SshNet.Tests.Classes 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 269eb28b..79c928cf 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 @@ namespace Renci.SshNet.Tests.Classes 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 8f959541..ae724281 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 @@ namespace Renci.SshNet.Tests.Classes 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 de06ca46..c690c3a5 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 @@ namespace Renci.SshNet.Tests.Classes 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 6cb082b4..24291fe7 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.Net.Sockets; using System.Security.Cryptography; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -173,7 +174,7 @@ namespace Renci.SshNet.Tests.Classes }; 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 5bb6c151..9114ae15 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; using System.Net.Sockets; using System.Security.Cryptography; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -132,7 +133,7 @@ namespace Renci.SshNet.Tests.Classes 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 4da2ef1e..e8bb7bd7 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; using System.Net.Sockets; using System.Security.Cryptography; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -199,7 +200,7 @@ namespace Renci.SshNet.Tests.Classes }; 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 5afe3bc0..b3d75d5c 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 @@ namespace Renci.SshNet.Tests.Classes _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 eed1c71c..c48836ba 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 fea017d0..50125eb7 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 d2f03f67..a80c744d 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 eda2fc79..45bf5c02 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 77b0c42e..e0e809af 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 46dca30a..88aad7e6 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 5bb4c916..38a4b85e 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.Text; 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 @@ namespace Renci.SshNet.Tests.Classes 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 e308cac1..e138200a 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.Text; 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 @@ namespace Renci.SshNet.Tests.Classes 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 37fda2b8..4e1f4f3f 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.Text; using System.Threading; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -47,6 +48,7 @@ namespace Renci.SshNet.Tests.Classes _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 3a9d26fc..acd90303 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; using System.Text.RegularExpressions; using System.Threading.Tasks; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -32,6 +33,7 @@ namespace Renci.SshNet.Tests.Classes 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 997863cf..977f4781 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 @@ namespace Renci.SshNet.Tests.Classes 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 20968486..e14dcc10 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 @@ namespace Renci.SshNet.Tests.Classes 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 94d55ca8..516eca62 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 @@ namespace Renci.SshNet.Tests.Classes 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 680c4140..08ec7a65 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 @@ namespace Renci.SshNet.Tests.Classes 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 194af3c6..c5928291 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 @@ namespace Renci.SshNet.Tests.Classes 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 ac8c3847..f4739bd2 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 @@ namespace Renci.SshNet.Tests.Classes 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 f0622ccf..30de20fb 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 @@ namespace Renci.SshNet.Tests.Classes 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 bc094dc5..23c82bfc 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 @@ namespace Renci.SshNet.Tests.Classes 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 a6571651..bff51de3 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 @@ namespace Renci.SshNet.Tests.Classes 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 861c8c72..2733997c 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 @@ namespace Renci.SshNet.Tests.Classes 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 eff6e30a..676cec5f 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 @@ namespace Renci.SshNet.Tests.Classes 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 f968eb00..49efb4ea 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 @@ namespace Renci.SshNet.Tests.Classes 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 217ab84e..60804ee6 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.Globalization; using System.IO; using System.Text; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -35,6 +36,7 @@ namespace Renci.SshNet.Tests.Classes 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 79de6bb2..89398051 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 @@ namespace Renci.SshNet.Tests.Classes 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 bb997b28..8105fa0e 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 @@ namespace Renci.SshNet.Tests.Classes 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 1afc9223..af8a9f56 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 @@ namespace Renci.SshNet.Tests.Classes 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 238b277a..7496a03a 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 @@ namespace Renci.SshNet.Tests.Classes _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 273ceef4..af31b6a5 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 @@ namespace Renci.SshNet.Tests.Classes _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 5f538bc3..8d844788 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 @@ namespace Renci.SshNet.Tests.Classes _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 8e5a7b5f..89580f90 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 @@ namespace Renci.SshNet.Tests.Classes _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 bf1b3b78..a78fd44f 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 @@ namespace Renci.SshNet.Tests.Classes _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 4ee558c3..a375e437 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 @@ namespace Renci.SshNet.Tests.Classes _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 a7edaf9f..ddfde8d9 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 @@ namespace Renci.SshNet.Tests.Classes _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 3de5b14a..b25bad65 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 @@ namespace Renci.SshNet.Tests.Classes _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 eaae69dc..c6aba3ce 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 @@ namespace Renci.SshNet.Tests.Classes _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 e0da3678..5eb881f5 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 @@ namespace Renci.SshNet.Tests.Classes _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 96e768c9..17c1c897 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 @@ namespace Renci.SshNet.Tests.Classes _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 54adb93d..2629c90f 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 @@ namespace Renci.SshNet.Tests.Classes 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 e34294f9..fc4b2960 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 @@ namespace Renci.SshNet.Tests.Classes 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 bd083f51..7a81fc59 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 @@ namespace Renci.SshNet.Tests.Classes _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 5ab10b05..7c042c84 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 @@ namespace Renci.SshNet.Tests.Classes _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 19df7854..0f63f193 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 @@ namespace Renci.SshNet.Tests.Classes _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 f689d801..5d6fbe46 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 @@ namespace Renci.SshNet.Tests.Classes _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 cd555b47..c2416ebc 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 @@ namespace Renci.SshNet.Tests.Classes _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 ebb5b859..a1176475 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 @@ namespace Renci.SshNet.Tests.Classes _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 6a7f4566..d3301c03 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 @@ namespace Renci.SshNet.Tests.Classes _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 72b95ef8..eac62bb2 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 @@ namespace Renci.SshNet.Tests.Classes _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 121545be..4fb93ce2 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 @@ namespace Renci.SshNet.Tests.Classes _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 93af67cb..3521b22c 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 @@ namespace Renci.SshNet.Tests.Classes _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();