コード例 #1
0
        public void SftpValidateNegativeTestForInvalidAcceptAnySSHServerHostKey()
        {
            string  fileName   = Guid.NewGuid().ToString();
            string  folderPath = Guid.NewGuid().ToString();
            FtpUtil ftpUtil    = new FtpUtil(true);

            NameValueCollection namevalue = ftpUtil.GetNameValueCollection(false, true);

            namevalue.Add("AcceptAnySSHServerHostKey", Guid.NewGuid().ToString());

            IFTPConnectorTest connectorTest = new FileBasedProtocolConnectorClientTest <SFTPController>(namevalue);

            var message = connectorTest.DeleteFile(folderPath, fileName);

            Assert.AreEqual(message.StatusCode, HttpStatusCode.BadRequest, "Could not validate correctly");
        }
コード例 #2
0
        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");
        }