Bladeren bron

Remove ServiceFactory argument from SftpSession.

Gert Driesen 8 jaren geleden
bovenliggende
commit
b22690d985

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs

@@ -14,7 +14,6 @@ namespace Renci.SshNet.Tests.Classes.Sftp
     public class SftpSessionTest_Connected_RequestRead
     {
         private Mock<ISession> _sessionMock;
-        private Mock<IServiceFactory> _serviceFactoryMock;
         private Mock<IChannelSession> _channelSessionMock;
         private SftpSession _sftpSession;
         private int _operationTimeout;
@@ -40,7 +39,6 @@ namespace Renci.SshNet.Tests.Classes.Sftp
 
             _sessionMock = new Mock<ISession>(MockBehavior.Strict);
             _channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
-            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
 
             var sequence = new MockSequence();
 
@@ -84,7 +82,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
                     }
                 );
 
-            _sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _serviceFactoryMock.Object);
+            _sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding);
             _sftpSession.Connect();
         }
 

+ 1 - 3
src/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs

@@ -14,7 +14,6 @@ namespace Renci.SshNet.Tests.Classes.Sftp
     {
         private Mock<ISession> _sessionMock;
         private Mock<IChannelSession> _channelSessionMock;
-        private Mock<IServiceFactory> _serviceFactoryMock;
         private SftpSession _sftpSession;
         private int _operationTimeout;
         private SftpFileSytemInformation _actual;
@@ -40,7 +39,6 @@ namespace Renci.SshNet.Tests.Classes.Sftp
 
             _sessionMock = new Mock<ISession>(MockBehavior.Strict);
             _channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
-            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
 
             var sequence = new MockSequence();
 
@@ -84,7 +82,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
                     }
                 );
 
-            _sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _serviceFactoryMock.Object);
+            _sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding);
             _sftpSession.Connect();
         }
 

+ 1 - 1
src/Renci.SshNet/ServiceFactory.cs

@@ -51,7 +51,7 @@ namespace Renci.SshNet
         /// </returns>
         public ISftpSession CreateSftpSession(ISession session, int operationTimeout, Encoding encoding)
         {
-            return new SftpSession(session, operationTimeout, encoding, this);
+            return new SftpSession(session, operationTimeout, encoding);
         }
 
         /// <summary>

+ 1 - 3
src/Renci.SshNet/Sftp/SftpSession.cs

@@ -17,7 +17,6 @@ namespace Renci.SshNet.Sftp
         private readonly Dictionary<uint, SftpRequest> _requests = new Dictionary<uint, SftpRequest>();
         //FIXME: obtain from SftpClient!
         private readonly List<byte> _data = new List<byte>(32 * 1024);
-        private readonly IServiceFactory _serviceFactory;
         private EventWaitHandle _sftpVersionConfirmed = new AutoResetEvent(false);
         private IDictionary<string, string> _supportedExtensions;
 
@@ -50,10 +49,9 @@ namespace Renci.SshNet.Sftp
             }
         }
 
-        public SftpSession(ISession session, int operationTimeout, Encoding encoding, IServiceFactory serviceFactory)
+        public SftpSession(ISession session, int operationTimeout, Encoding encoding)
             : base(session, "sftp", operationTimeout, encoding)
         {
-            _serviceFactory = serviceFactory;
         }
 
         /// <summary>