public void ValidateDoesNotThrow() { var wha = new WcfWebHttpAdapter.Inbound( a => { a.Address = new Uri("/dummy.svc", UriKind.Relative); a.Identity = EndpointIdentityFactory.CreateSpnIdentity("spn_name"); a.SecurityMode = WebHttpSecurityMode.Transport; a.ServiceCertificate = "thumbprint"; a.TransportClientCredentialType = HttpClientCredentialType.Windows; a.AddMessageBodyForHttpVerbs = "GET,HEAD"; a.HttpHeaders = "Content-Type: application/json\r\nReferer: http://www.my.org/"; a.HttpUrlMapping = new HttpUrlMapping { new HttpUrlMappingOperation("AddCustomer", "POST", "/Customer/{id}"), new HttpUrlMappingOperation("DeleteCustomer", "DELETE", "/Customer/{id}") }; a.VariableMapping = new VariableMapping { new VariablePropertyMapping("id", BizTalkFactoryProperties.ReceiverName) }; a.MaxConcurrentCalls = 400; }); Assert.That(() => ((ISupportValidation)wha).Validate(), Throws.Nothing); }
public void SerializeToXml() { var wha = new WcfWebHttpAdapter.Inbound( a => { a.Address = new Uri("/dummy.svc", UriKind.Relative); a.Identity = EndpointIdentityFactory.CreateSpnIdentity("spn_name"); a.SecurityMode = WebHttpSecurityMode.Transport; a.ServiceCertificate = "thumbprint"; a.TransportClientCredentialType = HttpClientCredentialType.Windows; a.AddMessageBodyForHttpVerbs = "GET,HEAD"; a.HttpHeaders = "Content-Type: application/json\r\nReferer: http://www.my.org/"; a.HttpUrlMapping = new HttpUrlMapping { new HttpUrlMappingOperation("AddCustomer", "POST", "/Customer/{id}"), new HttpUrlMappingOperation("DeleteCustomer", "DELETE", "/Customer/{id}") }; a.VariableMapping = new VariableMapping { new VariablePropertyMapping("id", BizTalkFactoryProperties.ReceiverName) }; a.MaxConcurrentCalls = 400; }); var xml = ((IAdapterBindingSerializerFactory)wha).GetAdapterBindingSerializer().Serialize(); Assert.That( xml, Is.EqualTo( "<CustomProps>" + "<MaxReceivedMessageSize vt=\"3\">65535</MaxReceivedMessageSize>" + "<SecurityMode vt=\"8\">Transport</SecurityMode>" + "<TransportClientCredentialType vt=\"8\">Windows</TransportClientCredentialType>" + "<ServiceCertificate vt=\"8\">thumbprint</ServiceCertificate>" + "<UseSSO vt=\"11\">0</UseSSO>" + "<MaxConcurrentCalls vt=\"3\">400</MaxConcurrentCalls>" + "<SuspendMessageOnFailure vt=\"11\">-1</SuspendMessageOnFailure>" + "<IncludeExceptionDetailInFaults vt=\"11\">-1</IncludeExceptionDetailInFaults>" + "<DisableLocationOnFailure vt=\"11\">0</DisableLocationOnFailure>" + "<HttpMethodAndUrl vt=\"8\">" + ( "<BtsHttpUrlMapping>" + "<Operation Name=\"AddCustomer\" Method=\"POST\" Url=\"/Customer/{id}\" />" + "<Operation Name=\"DeleteCustomer\" Method=\"DELETE\" Url=\"/Customer/{id}\" />" + "</BtsHttpUrlMapping>") + "</HttpMethodAndUrl>" + "<VariablePropertyMapping vt=\"8\">" + ( "<BtsVariablePropertyMapping>" + string.Format( "<Variable Name=\"id\" PropertyName=\"{0}\" PropertyNamespace=\"{1}\" />", BizTalkFactoryProperties.ReceiverName.Name, BizTalkFactoryProperties.ReceiverName.Namespace) + "</BtsVariablePropertyMapping>") + "</VariablePropertyMapping>" + "<AddMessageBodyForHttpVerbs vt=\"8\">" + ( "GET,HEAD") + "</AddMessageBodyForHttpVerbs>" + "<HttpHeaders vt=\"8\">" + ( "Content-Type: application/json\r\nReferer: http://www.my.org/") + "</HttpHeaders>" + "<ServiceBehaviorConfiguration vt=\"8\">" + ( "<behavior name=\"ServiceBehavior\" />") + "</ServiceBehaviorConfiguration>" + "<EndpointBehaviorConfiguration vt=\"8\">" + ( "<behavior name=\"EndpointBehavior\" />") + "</EndpointBehaviorConfiguration>" + "<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>")); }