public void ValidateDoesNotThrow() { var wca = new WcfCustomIsolatedAdapter.Inbound <NetTcpBindingElement>( a => { const int tenMegaBytes = 1024 * 1024 * 10; a.Address = new Uri("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); }
public void SerializeToXml() { var wca = new WcfCustomIsolatedAdapter.Inbound <NetTcpBindingElement>( a => { const int tenMegaBytes = 1024 * 1024 * 10; a.Address = new Uri("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\">" + "<binding name=\"netTcpBinding\" openTimeout=\"00:03:00\" maxReceivedMessageSize=\"10485760\">" + "<readerQuotas maxStringContentLength=\"10485760\" maxArrayLength=\"10485760\" />" + "<security><transport protectionLevel=\"Sign\" /></security>" + "</binding>" + "</BindingConfiguration>" + "<ServiceBehaviorConfiguration vt=\"8\"><behavior name=\"ServiceBehavior\" /></ServiceBehaviorConfiguration>" + "<EndpointBehaviorConfiguration vt=\"8\"><behavior name=\"EndpointBehavior\" />" + "</EndpointBehaviorConfiguration>" + "<InboundBodyLocation vt=\"8\">UseBodyElement</InboundBodyLocation>" + "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" + "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" + "<OutboundXmlTemplate vt=\"8\"><bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/></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>")); }