[Ignore] // placeholder for actual test public void SetPermissionsTest() { SftpSession sftpSession = null; // TODO: Initialize to an appropriate value string fullName = string.Empty; // TODO: Initialize to an appropriate value SftpFileAttributes attributes = null; // TODO: Initialize to an appropriate value SftpFile target = new SftpFile(sftpSession, fullName, attributes); // TODO: Initialize to an appropriate value short mode = 0; // TODO: Initialize to an appropriate value target.SetPermissions(mode); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void LengthTest() { SftpSession session = null; // TODO: Initialize to an appropriate value string path = string.Empty; // TODO: Initialize to an appropriate value FileMode mode = new FileMode(); // TODO: Initialize to an appropriate value SftpFileStream target = new SftpFileStream(session, path, mode); // TODO: Initialize to an appropriate value long actual; actual = target.Length; Assert.Inconclusive("Verify the correctness of this test method."); }
public void WriteByteTest() { SftpSession session = null; // TODO: Initialize to an appropriate value string path = string.Empty; // TODO: Initialize to an appropriate value FileMode mode = new FileMode(); // TODO: Initialize to an appropriate value SftpFileStream target = new SftpFileStream(session, path, mode); // TODO: Initialize to an appropriate value byte value = 0; // TODO: Initialize to an appropriate value target.WriteByte(value); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
[Ignore] // placeholder for actual test public void LengthTest() { SftpSession sftpSession = null; // TODO: Initialize to an appropriate value string fullName = string.Empty; // TODO: Initialize to an appropriate value SftpFileAttributes attributes = null; // TODO: Initialize to an appropriate value SftpFile target = new SftpFile(sftpSession, fullName, attributes); // TODO: Initialize to an appropriate value long actual; actual = target.Length; Assert.Inconclusive("Verify the correctness of this test method."); }
public void ReadByteTest() { SftpSession session = null; // TODO: Initialize to an appropriate value string path = string.Empty; // TODO: Initialize to an appropriate value FileMode mode = new FileMode(); // TODO: Initialize to an appropriate value SftpFileStream target = new SftpFileStream(session, path, mode); // TODO: Initialize to an appropriate value int expected = 0; // TODO: Initialize to an appropriate value int actual; actual = target.ReadByte(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
[Ignore] // placeholder for actual test public void ToStringTest() { SftpSession sftpSession = null; // TODO: Initialize to an appropriate value string fullName = string.Empty; // TODO: Initialize to an appropriate value SftpFileAttributes attributes = null; // TODO: Initialize to an appropriate value SftpFile target = new SftpFile(sftpSession, fullName, attributes); // TODO: Initialize to an appropriate value string expected = string.Empty; // TODO: Initialize to an appropriate value string actual; actual = target.ToString(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
[Ignore] // placeholder for actual test public void OwnerCanWriteTest() { SftpSession sftpSession = null; // TODO: Initialize to an appropriate value string fullName = string.Empty; // TODO: Initialize to an appropriate value SftpFileAttributes attributes = null; // TODO: Initialize to an appropriate value SftpFile target = new SftpFile(sftpSession, fullName, attributes); // TODO: Initialize to an appropriate value bool expected = false; // TODO: Initialize to an appropriate value bool actual; target.OwnerCanWrite = expected; actual = target.OwnerCanWrite; Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
[Ignore] // placeholder for actual test public void LastWriteTimeUtcTest() { SftpSession sftpSession = null; // TODO: Initialize to an appropriate value string fullName = string.Empty; // TODO: Initialize to an appropriate value SftpFileAttributes attributes = null; // TODO: Initialize to an appropriate value SftpFile target = new SftpFile(sftpSession, fullName, attributes); // TODO: Initialize to an appropriate value DateTime expected = new DateTime(); // TODO: Initialize to an appropriate value DateTime actual; target.LastWriteTimeUtc = expected; actual = target.LastWriteTimeUtc; Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
// Protected implementation of Dispose pattern. protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { SftpSession?.Dispose(); } disposed = true; }
public void SeekTest() { SftpSession session = null; // TODO: Initialize to an appropriate value string path = string.Empty; // TODO: Initialize to an appropriate value FileMode mode = new FileMode(); // TODO: Initialize to an appropriate value SftpFileStream target = new SftpFileStream(session, path, mode); // TODO: Initialize to an appropriate value long offset = 0; // TODO: Initialize to an appropriate value SeekOrigin origin = new SeekOrigin(); // TODO: Initialize to an appropriate value long expected = 0; // TODO: Initialize to an appropriate value long actual; actual = target.Seek(offset, origin); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
protected override async Task <Action <NativeActivityContext> > ExecuteAsync(NativeActivityContext context, CancellationToken cancellationToken) { IFtpSession ftpSession = null; FtpConfiguration ftpConfiguration = new FtpConfiguration(Host.Get(context)); ftpConfiguration.Port = Port.Expression == null ? null : (int?)Port.Get(context); ftpConfiguration.UseAnonymousLogin = UseAnonymousLogin; ftpConfiguration.SslProtocols = SslProtocols; ftpConfiguration.ClientCertificatePath = ClientCertificatePath.Get(context); ftpConfiguration.ClientCertificatePassword = ClientCertificatePassword.Get(context); ftpConfiguration.AcceptAllCertificates = AcceptAllCertificates; if (ftpConfiguration.UseAnonymousLogin == false) { ftpConfiguration.Username = Username.Get(context); ftpConfiguration.Password = Password.Get(context); if (string.IsNullOrWhiteSpace(ftpConfiguration.Username)) { throw new ArgumentNullException(Resources.EmptyUsernameException); } if (string.IsNullOrWhiteSpace(ftpConfiguration.Password) && string.IsNullOrWhiteSpace(ftpConfiguration.ClientCertificatePath)) { throw new ArgumentNullException(Resources.NoValidAuthenticationMethod); } } if (UseSftp) { ftpSession = new SftpSession(ftpConfiguration); } else { ftpSession = new FtpSession(ftpConfiguration, FtpsMode); } await ftpSession.OpenAsync(cancellationToken); return((nativeActivityContext) => { if (Body != null) { _ftpSession = ftpSession; nativeActivityContext.ScheduleAction(Body, ftpSession, OnCompleted, OnFaulted); } }); }
public void BeginWriteTest() { SftpSession session = null; // TODO: Initialize to an appropriate value string path = string.Empty; // TODO: Initialize to an appropriate value FileMode mode = new FileMode(); // TODO: Initialize to an appropriate value SftpFileStream target = new SftpFileStream(session, path, mode); // TODO: Initialize to an appropriate value byte[] buffer = null; // TODO: Initialize to an appropriate value int offset = 0; // TODO: Initialize to an appropriate value int count = 0; // TODO: Initialize to an appropriate value AsyncCallback callback = null; // TODO: Initialize to an appropriate value object state = null; // TODO: Initialize to an appropriate value IAsyncResult expected = null; // TODO: Initialize to an appropriate value IAsyncResult actual; actual = target.BeginWrite(buffer, offset, count, callback, state); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
protected override async Task <Action <NativeActivityContext> > ExecuteAsync(NativeActivityContext context, CancellationToken cancellationToken) { IFtpSession ftpSession = null; FtpConfiguration ftpConfiguration = new FtpConfiguration(Host.Get(context)); ftpConfiguration.Port = Port.Expression == null ? null : (int?)Port.Get(context); ftpConfiguration.UseAnonymousLogin = UseAnonymousLogin; ftpConfiguration.ClientCertificatePath = ClientCertificatePath.Get(context); ftpConfiguration.ClientCertificatePassword = ClientCertificatePassword.Get(context); ftpConfiguration.AcceptAllCertificates = AcceptAllCertificates; if (ftpConfiguration.UseAnonymousLogin == false) { ftpConfiguration.Username = Username.Get(context); ftpConfiguration.Password = Password.Get(context); } if (UseSftp) { ftpSession = new SftpSession(ftpConfiguration); } else { ftpSession = new FtpSession(ftpConfiguration, FtpsMode); } await ftpSession.OpenAsync(cancellationToken); return((nativeActivityContext) => { if (Body != null) { _ftpSession = ftpSession; nativeActivityContext.ScheduleAction(Body, ftpSession, OnCompleted, OnFaulted); } }); }
internal SftpContextStream(SftpSession session, string path, FileMode mode, FileAccess access, SftpFileAttributes attributes) { Flags flags = Flags.None; switch (access) { case FileAccess.Read: flags = Flags.Read; break; case FileAccess.Write: flags = Flags.Write; break; case FileAccess.ReadWrite: flags = Flags.Read | Flags.Write; break; } switch (mode) { case FileMode.Append: flags |= Flags.Append; break; case FileMode.Create: if (attributes == null) { flags |= Flags.CreateNew; } else { flags |= Flags.Truncate; } break; case FileMode.CreateNew: flags |= Flags.CreateNew; break; case FileMode.Open: break; case FileMode.OpenOrCreate: flags |= Flags.CreateNewOrOpen; break; case FileMode.Truncate: flags |= Flags.Truncate; break; } _session = session; _handle = _session.RequestOpen(path, flags); _attributes = attributes ?? _session.RequestFStat(_handle); if (access.HasFlag(FileAccess.Write)) { _writeBuffer = new byte[WRITE_BUFFER_SIZE]; _writeMode = true; } _position = mode != FileMode.Append ? 0 : _attributes.Size; }
public SftpContext(SftpSession session, string path, FileMode mode, FileAccess access, SftpFileAttributes attributes) { _stream = new SftpContextStream(session, path, mode, access, attributes); }