예제 #1
0
        public void ValidateDoesNotThrow()
        {
            var wca = new WcfCustomAdapter.Inbound <NetTcpBindingElement>(
                a => {
                const int tenMegaBytes = 1024 * 1024 * 10;
                a.Address = new EndpointAddress("net.tcp://localhost/biztalk.factory/service.svc");
                a.Binding.MaxReceivedMessageSize              = tenMegaBytes;
                a.Binding.ReaderQuotas.MaxArrayLength         = tenMegaBytes;
                a.Binding.ReaderQuotas.MaxStringContentLength = tenMegaBytes;
                a.Binding.Security.Mode = SecurityMode.Transport;
                a.Binding.Security.Transport.ProtectionLevel      = ProtectionLevel.Sign;
                a.Binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
                a.OpenTimeout = TimeSpan.FromMinutes(3);
            });

            Assert.That(() => ((ISupportValidation)wca).Validate(), Throws.Nothing);
        }
예제 #2
0
        public void SerializeToXml()
        {
            var wca = new WcfCustomAdapter.Inbound <NetTcpBindingElement>(
                a => {
                const int tenMegaBytes = 1024 * 1024 * 10;
                a.Address = new EndpointAddress("net.tcp://localhost/biztalk.factory/service.svc");
                a.Binding.MaxReceivedMessageSize              = tenMegaBytes;
                a.Binding.ReaderQuotas.MaxArrayLength         = tenMegaBytes;
                a.Binding.ReaderQuotas.MaxStringContentLength = tenMegaBytes;
                a.Binding.Security.Mode = SecurityMode.Transport;
                a.Binding.Security.Transport.ProtectionLevel      = ProtectionLevel.Sign;
                a.Binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
                a.OpenTimeout = TimeSpan.FromMinutes(3);
                // TODO LeaseTimeout
            });
            var xml = ((IAdapterBindingSerializerFactory)wca).GetAdapterBindingSerializer().Serialize();

            Assert.That(
                xml,
                Is.EqualTo(
                    "<CustomProps>" +
                    "<BindingType vt=\"8\">netTcpBinding</BindingType>" +
                    "<BindingConfiguration vt=\"8\">" +
                    "&lt;binding name=\"netTcpBinding\" openTimeout=\"00:03:00\" maxReceivedMessageSize=\"10485760\"&gt;" +
                    "&lt;readerQuotas maxStringContentLength=\"10485760\" maxArrayLength=\"10485760\" /&gt;" +
                    "&lt;security&gt;&lt;transport protectionLevel=\"Sign\" /&gt;&lt;/security&gt;" +
                    "&lt;/binding&gt;" +
                    "</BindingConfiguration>" +
                    "<ServiceBehaviorConfiguration vt=\"8\">&lt;behavior name=\"ServiceBehavior\" /&gt;</ServiceBehaviorConfiguration>" +
                    "<EndpointBehaviorConfiguration vt=\"8\">&lt;behavior name=\"EndpointBehavior\" /&gt;" + "</EndpointBehaviorConfiguration>" +
                    "<InboundBodyLocation vt=\"8\">UseBodyElement</InboundBodyLocation>" +
                    "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" +
                    "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                    "<OutboundXmlTemplate vt=\"8\">&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;</OutboundXmlTemplate>" +
                    "<DisableLocationOnFailure vt=\"11\">0</DisableLocationOnFailure>" +
                    "<SuspendMessageOnFailure vt=\"11\">-1</SuspendMessageOnFailure>" +
                    "<IncludeExceptionDetailInFaults vt=\"11\">-1</IncludeExceptionDetailInFaults>" +
                    "<CredentialType vt=\"8\">None</CredentialType>" +
                    "<OrderedProcessing vt=\"11\">0</OrderedProcessing>" +
                    "</CustomProps>"));
        }