public void SftpValidateNegativeTestForServerAddress() { string folderPath = Guid.NewGuid().ToString(); FtpUtil ftpUtil = new FtpUtil(true); NameValueCollection namevalue = ftpUtil.GetNameValueCollection(false, true); namevalue.Add("AcceptAnySSHServerHostKey", "false"); namevalue.Set("SftpServerAddress", string.Empty); this.AddAuthenticationDetailsToIsolatedStorage(AuthenticationType.Password, namevalue["FtpUserName"], namevalue["FtpPassword"], MultiFactorAuthPpkResourceName, "rsa2048"); IFTPConnectorTest connectorTest = new FileBasedProtocolConnectorClientTest <SFTPController>(namevalue); var message = connectorTest.ListFile(folderPath); Assert.AreEqual(message.StatusCode, HttpStatusCode.BadRequest, "Could not validate correctly"); }
public void SftpValidatePositiveTestValidAesCipher() { string folderPath = Guid.NewGuid().ToString(); FTPTestHelper ftpTestHelper = new FTPTestHelper(true); ftpTestHelper.CreateFolder(folderPath); FtpUtil ftpUtil = new FtpUtil(true); NameValueCollection namevalue = ftpUtil.GetNameValueCollection(false, true); namevalue.Add("AcceptAnySSHServerHostKey", "true"); namevalue.Add("EncryptCipher", "Aes"); this.AddAuthenticationDetailsToIsolatedStorage(AuthenticationType.Password, namevalue["FtpUserName"], namevalue["FtpPassword"], MultiFactorAuthPpkResourceName, ftpUtil.SftpPrivateKeyPassword); IFTPConnectorTest connectorTest = new FileBasedProtocolConnectorClientTest <SFTPController>(namevalue); var message = connectorTest.ListFile(folderPath); Assert.AreEqual(message.StatusCode, HttpStatusCode.OK, "Could not validate correctly"); }
public void SftpValidatePositiveTestForVerifyPrivateKey() { string folderPath = Guid.NewGuid().ToString(); FtpUtil ftpUtil = new FtpUtil(true); FTPTestHelper ftpTestHelper = new FTPTestHelper(true); ftpTestHelper.CreateFolder(folderPath); NameValueCollection namevalue = ftpUtil.GetNameValueCollection(false, true); namevalue.Add("PrivateKey", Environment.CurrentDirectory + "\\rsa2048.ppk"); namevalue.Add("PrivateKeyPassword", ftpUtil.SftpPrivateKeyPassword); namevalue.Set("FtpPassword", Guid.NewGuid().ToString()); namevalue.Add("AcceptAnySSHServerHostKey", "true"); this.AddAuthenticationDetailsToIsolatedStorage(AuthenticationType.MultiFactor, namevalue["FtpUserName"], namevalue["FtpPassword"], Rsa2048ResourceName, namevalue["PrivateKeyPassword"]); IFTPConnectorTest connectorTest = new FileBasedProtocolConnectorClientTest <SFTPController>(namevalue); var message = connectorTest.ListFile(folderPath); Assert.AreEqual(message.StatusCode, HttpStatusCode.OK, "Could not validate correctly"); }