public void BasicHttpBinding_ImportEndpoints() { var label = new TestLabel("BasicHttpBinding_ImportEndpoints"); var doc = TestContext.LoadMetadata("BasicHttp"); var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata; label.EnterScope("wsdl"); Assert.That(sd.Bindings, Is.Not.Null, label.Get()); Assert.That(sd.Bindings.Count, Is.EqualTo(1), label.Get()); var binding = sd.Bindings [0]; Assert.That(sd.Services, Is.Not.Null, label.Get()); Assert.That(sd.Services.Count, Is.EqualTo(1), label.Get()); var service = sd.Services [0]; Assert.That(service.Ports, Is.Not.Null, label.Get()); Assert.That(service.Ports.Count, Is.EqualTo(1), label.Get()); var port = service.Ports [0]; Assert.That(sd.PortTypes, Is.Not.Null, label.Get()); Assert.That(sd.PortTypes.Count, Is.EqualTo(1), label.Get()); var portType = sd.PortTypes [0]; label.LeaveScope(); var importer = new WsdlImporter(doc); label.EnterScope("by-service"); var byService = importer.ImportEndpoints(service); BindingTestAssertions.CheckImportErrors(importer, label); Assert.That(byService, Is.Not.Null, label.Get()); Assert.That(byService.Count, Is.EqualTo(1), label.Get()); label.LeaveScope(); label.EnterScope("by-binding"); var byBinding = importer.ImportEndpoints(binding); BindingTestAssertions.CheckImportErrors(importer, label); Assert.That(byBinding, Is.Not.Null, label.Get()); Assert.That(byBinding.Count, Is.EqualTo(1), label.Get()); label.LeaveScope(); label.EnterScope("by-port-type"); var byPortType = importer.ImportEndpoints(portType); BindingTestAssertions.CheckImportErrors(importer, label); Assert.That(byPortType, Is.Not.Null, label.Get()); Assert.That(byPortType.Count, Is.EqualTo(1), label.Get()); label.LeaveScope(); }
public virtual void NetTcp_Binding() { var label = new TestLabel("NetTcp_Binding"); label.EnterScope("None"); BindingTestAssertions.CheckNetTcpBinding( new NetTcpBinding(SecurityMode.None), SecurityMode.None, false, TransferMode.Buffered, label); label.LeaveScope(); label.EnterScope("Transport"); BindingTestAssertions.CheckNetTcpBinding( new NetTcpBinding(SecurityMode.Transport), SecurityMode.Transport, false, TransferMode.Buffered, label); label.LeaveScope(); }
public void BasicHttpBinding_ImportBinding() { var label = new TestLabel("BasicHttpBinding_ImportBinding"); var doc = TestContext.LoadMetadata("BasicHttp"); var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata; var wsdlBinding = sd.Bindings [0]; var importer = new WsdlImporter(doc); Assert.That(sd.Bindings, Is.Not.Null, label.Get()); Assert.That(sd.Bindings.Count, Is.EqualTo(1), label.Get()); var binding = importer.ImportBinding(wsdlBinding); BindingTestAssertions.CheckImportErrors(importer, label); Assert.That(binding, Is.Not.Null, label.Get()); }
public void BasicHttpBinding_ImportEndpoint() { var label = new TestLabel("BasicHttpBinding_ImportEndpoint"); var doc = TestContext.LoadMetadata("BasicHttp"); var sd = (WS.ServiceDescription)doc.MetadataSections [0].Metadata; label.EnterScope("wsdl"); Assert.That(sd.Services, Is.Not.Null, label.Get()); Assert.That(sd.Services.Count, Is.EqualTo(1), label.Get()); var service = sd.Services [0]; Assert.That(service.Ports, Is.Not.Null, label.Get()); Assert.That(service.Ports.Count, Is.EqualTo(1), label.Get()); label.LeaveScope(); var importer = new WsdlImporter(doc); var port = importer.ImportEndpoint(service.Ports [0]); BindingTestAssertions.CheckImportErrors(importer, label); Assert.That(port, Is.Not.Null, label.Get()); }
public void Mtom_Policy() { var label = new TestLabel("Mtom_Policy"); var contract = new ContractDescription("MyContract"); var binding = new BasicHttpBinding(); binding.MessageEncoding = WSMessageEncoding.Mtom; var endpoint = new ServiceEndpoint( contract, binding, new EndpointAddress(HttpUri)); var exporter = new WsdlExporter(); exporter.ExportEndpoint(endpoint); Assert.That(exporter.GeneratedWsdlDocuments, Is.Not.Null, label.Get()); Assert.That(exporter.GeneratedWsdlDocuments.Count, Is.EqualTo(1), label.Get()); var wsdl = exporter.GeneratedWsdlDocuments [0]; Assert.That(wsdl.Bindings, Is.Not.Null, label.Get()); Assert.That(wsdl.Bindings.Count, Is.EqualTo(1), label.Get()); var wsb = wsdl.Bindings [0]; label.EnterScope("Binding"); Assert.That(wsb.Extensions, Is.Not.Null, label.Get()); Assert.That(wsb.Extensions.Count, Is.EqualTo(2), label.Get()); label.LeaveScope(); label.EnterScope("Extensions"); WS.SoapBinding soap = null; XmlElement xml = null; foreach (var extension in wsb.Extensions) { if (extension is WS.SoapBinding) { soap = (WS.SoapBinding)extension; } else if (extension is XmlElement) { xml = (XmlElement)extension; } else { Assert.Fail("Unknown extension.", label); } } Assert.That(soap, Is.Not.Null, label.Get()); Assert.That(xml, Is.Not.Null, label.Get()); label.LeaveScope(); label.EnterScope("Policy"); var assertions = BindingTestAssertions.AssertPolicy(wsdl, xml, label); Assert.That(assertions.Count, Is.EqualTo(1), label.Get()); var assertion = assertions [0]; Assert.That(assertion.NamespaceURI, Is.EqualTo("http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization"), label.Get()); Assert.That(assertion.LocalName, Is.EqualTo("OptimizedMimeSerialization"), label.Get()); label.LeaveScope(); }