public void ValidateDoesNotThrow()
        {
            var osa = new SftpAdapter.Outbound(
                a => {
                a.ServerAddress   = "sftp.server.com";
                a.Port            = 23;
                a.FolderPath      = "/in/from_bts/";
                a.ConnectionLimit = 6;

                a.ClientAuthenticationMode = ClientAuthenticationMode.MultiFactorAuthentication;
                a.PrivateKeyFile           = @"c:\files\key.ppk";
                a.PrivateKeyPassword       = "******";
                a.UserName = "******";
                a.Password = "******";
                a.SshServerHostKeyFingerPrint = "fingerprint";
                a.EncryptionCipher            = EncryptionCipher.AES;

                a.ProxyAddress  = "proxy.server.com";
                a.ProxyPort     = 1082;
                a.ProxyType     = ProxyType.SOCKS4;
                a.ProxyUserName = "******";
                a.ProxyPassword = "******";
            });

            Assert.That(() => ((ISupportValidation)osa).Validate(), Throws.Nothing);
        }
        public void ValidateDoesNotThrow()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var osa = new SftpAdapter.Outbound(
                a => {
                a.ServerAddress   = "sftp.server.com";
                a.Port            = 23;
                a.FolderPath      = "in/from_bts";
                a.ConnectionLimit = 6;

                a.ClientAuthenticationMode = ClientAuthenticationMode.MultiFactorAuthentication;
                a.PrivateKeyFile           = @"c:\file\key.ppk";
                a.PrivateKeyPassword       = "******";
                a.UserName = "******";
                a.Password = "******";
                a.SshServerHostKeyFingerPrint = "fingerprint";
                a.EncryptionCipher            = EncryptionCipher.AES;

                a.ProxyAddress  = "proxy.server.com";
                a.ProxyPort     = 1082;
                a.ProxyType     = ProxyType.SOCKS4;
                a.ProxyUserName = "******";
                a.ProxyPassword = "******";
            });

            Invoking(() => ((ISupportValidation)osa).Validate()).Should().NotThrow();
        }
        public void SerializeToXml()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var osa = new SftpAdapter.Outbound(
                a => {
                a.ServerAddress   = "sftp.server.com";
                a.Port            = 23;
                a.FolderPath      = "in/from_bts";
                a.ConnectionLimit = 6;

                a.ClientAuthenticationMode = ClientAuthenticationMode.MultiFactorAuthentication;
                a.PrivateKeyFile           = @"c:\file\key.ppk";
                a.PrivateKeyPassword       = "******";
                a.UserName = "******";
                a.Password = "******";
                a.SshServerHostKeyFingerPrint = "fingerprint";
                a.EncryptionCipher            = EncryptionCipher.AES;

                a.ProxyAddress  = "proxy.server.com";
                a.ProxyPort     = 1082;
                a.ProxyType     = ProxyType.SOCKS4;
                a.ProxyUserName = "******";
                a.ProxyPassword = "******";
            });
            var xml = osa.GetAdapterBindingInfoSerializer().Serialize();

            xml.Should().Be(
                "<CustomProps>" + (
                    "<ServerAddress vt=\"8\">sftp.server.com</ServerAddress>" +
                    "<Port vt=\"3\">23</Port>" +
                    "<FolderPath vt=\"8\">in/from_bts</FolderPath>" +
                    "<TargetFileName vt=\"8\">%MessageID%.xml</TargetFileName>" +
                    "<AppendIfExists vt=\"11\">0</AppendIfExists>" +
                    "<AccessAnySSHServerHostKey vt=\"11\">0</AccessAnySSHServerHostKey>" +
                    "<SSHServerHostKey vt=\"8\">fingerprint</SSHServerHostKey>" +
                    "<PrivateKey vt=\"8\">c:\\file\\key.ppk</PrivateKey>" +
                    "<PrivateKeyPassword vt=\"8\">p@ssw0rd</PrivateKeyPassword>" +
                    "<ConnectionLimit vt=\"3\">6</ConnectionLimit>" +
                    "<MaxConnectionReuseTimeInSeconds vt=\"3\">0</MaxConnectionReuseTimeInSeconds>" +
                    "<UserName vt=\"8\">user</UserName>" +
                    "<Password vt=\"8\">p@ssw0rd</Password>" +
                    "<ClientAuthenticationMode vt=\"8\">MultiFactorAuthentication</ClientAuthenticationMode>" +
                    "<ProxyPassword vt=\"8\">p@ssw0rd</ProxyPassword>" +
                    "<ProxyUserName vt=\"8\">proxy-user</ProxyUserName>" +
                    "<ProxyType vt=\"8\">SOCKS4</ProxyType>" +
                    "<ProxyAddress vt=\"8\">proxy.server.com</ProxyAddress>" +
                    "<ProxyPort vt=\"3\">1082</ProxyPort>" +
                    "<EncryptionCipher vt=\"8\">AES</EncryptionCipher>" +
                    "<TransferMode vt=\"8\">Binary</TransferMode>") +
                "</CustomProps>");
        }
        public void SerializeToXml()
        {
            var osa = new SftpAdapter.Outbound(
                a => {
                a.ServerAddress   = "sftp.server.com";
                a.Port            = 23;
                a.FolderPath      = "/in/from_bts/";
                a.ConnectionLimit = 6;

                a.ClientAuthenticationMode = ClientAuthenticationMode.MultiFactorAuthentication;
                a.PrivateKeyFile           = @"c:\files\key.ppk";
                a.PrivateKeyPassword       = "******";
                a.UserName = "******";
                a.Password = "******";
                a.SshServerHostKeyFingerPrint = "fingerprint";
                a.EncryptionCipher            = EncryptionCipher.AES;

                a.ProxyAddress  = "proxy.server.com";
                a.ProxyPort     = 1082;
                a.ProxyType     = ProxyType.SOCKS4;
                a.ProxyUserName = "******";
                a.ProxyPassword = "******";
            });
            var xml = ((IAdapterBindingSerializerFactory)osa).GetAdapterBindingSerializer().Serialize();

            Assert.That(
                xml,
                Is.EqualTo(
                    "<CustomProps>" +
                    "<ServerAddress vt=\"8\">sftp.server.com</ServerAddress>" +
                    "<Port vt=\"3\">23</Port>" +
                    "<FolderPath vt=\"8\">/in/from_bts/</FolderPath>" +
                    "<TargetFileName vt=\"8\">%MessageID%.xml</TargetFileName>" +
                    "<AppendIfExists vt=\"11\">0</AppendIfExists>" +
                    "<AccessAnySSHServerHostKey vt=\"11\">0</AccessAnySSHServerHostKey>" +
                    "<SSHServerHostKey vt=\"8\">fingerprint</SSHServerHostKey>" +
                    "<PrivateKey vt=\"8\">c:\\files\\key.ppk</PrivateKey>" +
                    "<PrivateKeyPassword vt=\"8\">p@ssw0rd</PrivateKeyPassword>" +
                    "<ConnectionLimit vt=\"3\">6</ConnectionLimit>" +
                    "<UserName vt=\"8\">user</UserName>" +
                    "<Password vt=\"8\">p@ssw0rd</Password>" +
                    "<ClientAuthenticationMode vt=\"8\">MultiFactorAuthentication</ClientAuthenticationMode>" +
                    "<ProxyPassword vt=\"8\">p@ssw0rd</ProxyPassword>" +
                    "<ProxyUserName vt=\"8\">proxyuser</ProxyUserName>" +
                    "<ProxyType vt=\"8\">SOCKS4</ProxyType>" +
                    "<ProxyAddress vt=\"8\">proxy.server.com</ProxyAddress>" +
                    "<ProxyPort vt=\"3\">1082</ProxyPort>" +
                    "<EncryptionCipher vt=\"8\">AES</EncryptionCipher>" +
                    "</CustomProps>"));
        }