public void SftpValidateNegativeTestInvalidCipher() { string fileName = Guid.NewGuid().ToString(); string folderPath = Guid.NewGuid().ToString(); FtpUtil ftpUtil = new FtpUtil(true); NameValueCollection namevalue = ftpUtil.GetNameValueCollection(false, true); namevalue.Add("AcceptAnySSHServerHostKey", "true"); namevalue.Add("EncryptCipher", "Des"); IFTPConnectorTest connectorTest = new FileBasedProtocolConnectorClientTest <SFTPController>(namevalue); var message = connectorTest.UploadFile(Constants.UploadContents, folderPath, fileName); Assert.AreEqual(message.StatusCode, HttpStatusCode.BadRequest, "Could not validate correctly"); }
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 SftpValidateNegativeTestForInvalidEncryptCipher() { string fileName = Guid.NewGuid().ToString(); string folderPath = Guid.NewGuid().ToString(); FtpUtil ftpUtil = new FtpUtil(true); NameValueCollection namevalue = ftpUtil.GetNameValueCollection(false, true); namevalue.Add("EncryptCipher", Guid.NewGuid().ToString()); this.AddAuthenticationDetailsToIsolatedStorage(AuthenticationType.Password, namevalue["FtpUserName"], namevalue["FtpPassword"], MultiFactorAuthPpkResourceName, ftpUtil.SftpPrivateKeyPassword); IFTPConnectorTest connectorTest = new FileBasedProtocolConnectorClientTest <SFTPController>(namevalue); var message = connectorTest.DeleteFile(folderPath, fileName); Assert.AreEqual(message.StatusCode, HttpStatusCode.BadRequest, "Could not validate correctly"); }
public void SftpValidateNegativeTestForVerifyPrivateKeyMultiFactAuthServerInvalidUser() { string fileName = Guid.NewGuid().ToString(); string folderPath = Guid.NewGuid().ToString(); FtpUtil ftpUtil = new FtpUtil(true, true); NameValueCollection namevalue = ftpUtil.GetNameValueCollection(false, true); namevalue.Add("AcceptAnySSHServerHostKey", "true"); namevalue.Add("PrivateKey", Environment.CurrentDirectory + "/MultiFactorAuth.ppk"); IFTPConnectorTest connectorTest = new FileBasedProtocolConnectorClientTest <SFTPController>(namevalue); var message = connectorTest.GetFile(folderPath, fileName); Assert.AreEqual(message.StatusCode, HttpStatusCode.BadRequest, "Could not validate correctly"); }
public void SftpValidateNegativeInvalidUsername() { string fileName = Guid.NewGuid().ToString(); string folderPath = Guid.NewGuid().ToString(); FtpUtil ftpUtil = new FtpUtil(true); NameValueCollection namevalue = ftpUtil.GetNameValueCollection(false, true); namevalue.Add("AcceptAnySSHServerHostKey", "true"); namevalue.Set("FtpUserName", Guid.NewGuid().ToString()); this.AddAuthenticationDetailsToIsolatedStorage(AuthenticationType.Password, namevalue["FtpUserName"], namevalue["FtpPassword"], MultiFactorAuthPpkResourceName, namevalue["PrivateKeyPassword"]); IFTPConnectorTest connectorTest = new FileBasedProtocolConnectorClientTest <SFTPController>(namevalue); var message = connectorTest.UploadFile(Constants.UploadContents, folderPath, fileName); Assert.AreEqual(message.StatusCode, HttpStatusCode.BadRequest, "Could not validate correctly"); }
public void SftpValidateNegativeTestForVerifyPrivateKey() { string fileName = Guid.NewGuid().ToString(); string folderPath = Guid.NewGuid().ToString(); FtpUtil ftpUtil = new FtpUtil(true); NameValueCollection namevalue = ftpUtil.GetNameValueCollection(false, true); namevalue.Add("AcceptAnySSHServerHostKey", "true"); namevalue.Add("PrivateKey", Environment.CurrentDirectory + "/rsa2048.ppk"); namevalue.Add("PrivateKeyPassword", Guid.NewGuid().ToString()); namevalue.Add("FtpPassword", Guid.NewGuid().ToString()); this.AddAuthenticationDetailsToIsolatedStorage(AuthenticationType.MultiFactor, namevalue["FtpUserName"], namevalue["FtpPassword"], Rsa2048ResourceName, namevalue["PrivateKeyPassword"]); IFTPConnectorTest connectorTest = new FileBasedProtocolConnectorClientTest <SFTPController>(namevalue); var message = connectorTest.GetFile(folderPath, fileName); 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"); }