public void ValidateDoesNotThrow() { var wha = new WcfWebHttpAdapter.Outbound( a => { a.Address = new EndpointAddress("https://localhost/dummy.svc"); a.Identity = EndpointIdentityFactory.CreateSpnIdentity("spn_name"); a.SecurityMode = WebHttpSecurityMode.Transport; a.ServiceCertificate = "thumbprint"; a.TransportClientCredentialType = HttpClientCredentialType.Basic; a.UserName = "******"; a.Password = "******"; a.UseAcsAuthentication = true; a.StsUri = new Uri("https://localhost/swt_token_issuer"); a.IssuerName = "issuer_name"; a.IssuerSecret = "secret"; a.SuppressMessageBodyForHttpVerbs = "GET"; a.HttpHeaders = "Content-Type: application/json"; 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.MaxReceivedMessageSize = 2048; }); Assert.That(() => ((ISupportValidation)wha).Validate(), Throws.Nothing); }
public void SerializeToXml() { var wha = new WcfWebHttpAdapter.Outbound( a => { a.Address = new EndpointAddress("https://localhost/dummy.svc"); a.Identity = EndpointIdentityFactory.CreateSpnIdentity("spn_name"); a.SecurityMode = WebHttpSecurityMode.Transport; a.ServiceCertificate = "thumbprint"; a.TransportClientCredentialType = HttpClientCredentialType.Basic; a.UserName = "******"; a.Password = "******"; a.UseAcsAuthentication = true; a.StsUri = new Uri("https://localhost/swt_token_issuer"); a.IssuerName = "issuer_name"; a.IssuerSecret = "secret"; a.SuppressMessageBodyForHttpVerbs = "GET"; a.HttpHeaders = "Content-Type: application/json"; 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.SendTimeout = TimeSpan.FromMinutes(2); a.MaxReceivedMessageSize = 2048; }); var xml = ((IAdapterBindingSerializerFactory)wha).GetAdapterBindingSerializer().Serialize(); Assert.That( xml, Is.EqualTo( "<CustomProps>" + "<MaxReceivedMessageSize vt=\"3\">2048</MaxReceivedMessageSize>" + "<SecurityMode vt=\"8\">Transport</SecurityMode>" + "<TransportClientCredentialType vt=\"8\">Basic</TransportClientCredentialType>" + "<ServiceCertificate vt=\"8\">thumbprint</ServiceCertificate>" + "<UseSSO vt=\"11\">0</UseSSO>" + "<UserName vt=\"8\">username</UserName>" + "<Password vt=\"8\">p@ssw0rd</Password>" + "<ProxyToUse vt=\"8\">None</ProxyToUse>" + "<SuppressMessageBodyForHttpVerbs vt=\"8\">GET</SuppressMessageBodyForHttpVerbs>" + "<HttpHeaders vt=\"8\">Content-Type: application/json</HttpHeaders>" + "<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>" + "<EndpointBehaviorConfiguration vt=\"8\">" + ( "<behavior name=\"EndpointBehavior\" />") + "</EndpointBehaviorConfiguration>" + "<StsUri vt=\"8\">https://localhost/swt_token_issuer</StsUri>" + "<IssuerName vt=\"8\">issuer_name</IssuerName>" + "<IssuerSecret vt=\"8\">secret</IssuerSecret>" + "<UseAcsAuthentication vt=\"11\">-1</UseAcsAuthentication>" + "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" + "<SendTimeout vt=\"8\">00:02:00</SendTimeout>" + "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" + "<Identity vt=\"8\">" + ( "<identity>\r\n" + " <servicePrincipalName value=\"spn_name\" />\r\n" + "</identity>") + "</Identity>" + "</CustomProps>")); }