public void SerializeToXml() { var wnt = new WcfNetTcpRelayAdapter.Inbound( a => { a.Address = new EndpointAddress("sb://biztalk.factory.servicebus.windows.net/batch-queue"); a.Identity = EndpointIdentityFactory.CreateSpnIdentity("spn_name"); a.MaxConcurrentCalls = 201; a.MaxReceivedMessageSize = 64512; a.SuspendRequestMessageOnFailure = true; a.IncludeExceptionDetailInFaults = true; a.StsUri = new Uri("https://biztalk.factory-sb.accesscontrol.windows.net/"); a.IssuerName = "issuer_name"; a.IssuerSecret = "issuer_secret"; a.EnableServiceDiscovery = true; a.ServiceDisplayName = "display_name"; }); var xml = ((IAdapterBindingSerializerFactory)wnt).GetAdapterBindingSerializer().Serialize(); Assert.That( xml, Is.EqualTo( "<CustomProps>" + "<MaxReceivedMessageSize vt=\"3\">64512</MaxReceivedMessageSize>" + "<SecurityMode vt=\"8\">Transport</SecurityMode>" + "<MessageClientCredentialType vt=\"8\">Windows</MessageClientCredentialType>" + "<AlgorithmSuite vt=\"8\">Basic256</AlgorithmSuite>" + "<TransportProtectionLevel vt=\"8\">EncryptAndSign</TransportProtectionLevel>" + "<RelayClientAuthenticationType vt=\"8\">RelayAccessToken</RelayClientAuthenticationType>" + "<LeaseTimeout vt=\"8\">00:00:00</LeaseTimeout>" + "<UseSSO vt=\"11\">0</UseSSO>" + "<MaxConcurrentCalls vt=\"3\">201</MaxConcurrentCalls>" + "<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>" + "<SuspendMessageOnFailure vt=\"11\">-1</SuspendMessageOnFailure>" + "<IncludeExceptionDetailInFaults vt=\"11\">-1</IncludeExceptionDetailInFaults>" + "<StsUri vt=\"8\">https://biztalk.factory-sb.accesscontrol.windows.net/</StsUri>" + "<IssuerName vt=\"8\">issuer_name</IssuerName>" + "<IssuerSecret vt=\"8\">issuer_secret</IssuerSecret>" + "<EnableServiceDiscovery vt=\"11\">-1</EnableServiceDiscovery>" + "<DiscoveryMode vt=\"8\">Public</DiscoveryMode>" + "<ServiceDisplayName vt=\"8\">display_name</ServiceDisplayName>" + "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" + "<SendTimeout vt=\"8\">00:01:00</SendTimeout>" + "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" + "<Identity vt=\"8\">" + ( "<identity>\r\n <servicePrincipalName value=\"spn_name\" />\r\n</identity>") + "</Identity>" + "</CustomProps>")) ; }
public void Validate() { var wnt = new WcfNetTcpRelayAdapter.Inbound( a => { a.Address = new EndpointAddress("https://biztalk.factory.servicebus.windows.net/batch-queue"); }); Assert.That( () => ((ISupportValidation)wnt).Validate(), Throws.TypeOf <ArgumentException>() .With.InnerException.TypeOf <ArgumentException>() .With.InnerException.Message.StartsWith("Invalid address scheme; expecting \"sb\" scheme.")); }
public void ValidateDoesNotThrow() { var wnt = new WcfNetTcpRelayAdapter.Inbound( a => { a.Address = new EndpointAddress("sb://biztalk.factory.servicebus.windows.net/batch-queue"); a.Identity = EndpointIdentityFactory.CreateSpnIdentity("spn_name"); a.MaxConcurrentCalls = 201; a.MaxReceivedMessageSize = 64512; a.SuspendRequestMessageOnFailure = true; a.IncludeExceptionDetailInFaults = true; a.StsUri = new Uri("https://biztalk.factory-sb.accesscontrol.windows.net/"); a.IssuerName = "issuer_name"; a.IssuerSecret = "issuer_secret"; a.EnableServiceDiscovery = true; a.ServiceDisplayName = "display_name"; }); Assert.That(() => ((ISupportValidation)wnt).Validate(), Throws.Nothing); }