You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
committed by
Jo Shields
parent
183bba2c9a
commit
6992685b86
@ -38,17 +38,19 @@ using System.ServiceModel;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.ServiceModel.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class MetadataResolverTest
|
||||
{
|
||||
string url = "http://localhost:37564/echo/mex";
|
||||
string url;
|
||||
//string url = "http://192.168.0.1:8080/echo/mex";
|
||||
|
||||
static HttpListener listener;
|
||||
IAsyncResult current_request;
|
||||
int remaining;
|
||||
int remaining, port;
|
||||
|
||||
static readonly string mex = File.ReadAllText ("Test/System.ServiceModel.Description/dump.xml");
|
||||
|
||||
@ -58,7 +60,9 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
if (listener != null)
|
||||
listener.Stop ();
|
||||
listener = new HttpListener ();
|
||||
listener.Prefixes.Add ("http://*:37564/echo/");
|
||||
port = NetworkHelpers.FindFreePort ();
|
||||
url = "http://localhost:" + port + "/echo/mex";
|
||||
listener.Prefixes.Add ("http://*:" + port + "/echo/");
|
||||
listener.Start ();
|
||||
current_request = listener.BeginGetContext (OnReceivedRequest, null);
|
||||
remaining = 1;
|
||||
|
@ -34,6 +34,8 @@ using System.ServiceModel.Description;
|
||||
using System.ServiceModel.Dispatcher;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.ServiceModel.Description
|
||||
{
|
||||
[TestFixture]
|
||||
@ -73,7 +75,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
b.ImpersonateCallerForAllOperations = true;
|
||||
b.PrincipalPermissionMode = PrincipalPermissionMode.None;
|
||||
|
||||
host.AddServiceEndpoint (typeof (TestService), new BasicHttpBinding (), new Uri ("http://localhost:37564"));
|
||||
host.AddServiceEndpoint (typeof (TestService), new BasicHttpBinding (), new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()));
|
||||
|
||||
host.Open ();
|
||||
}
|
||||
@ -86,7 +88,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
b.ImpersonateCallerForAllOperations = false;
|
||||
b.PrincipalPermissionMode = PrincipalPermissionMode.None;
|
||||
|
||||
host.AddServiceEndpoint (typeof (TestService2), new BasicHttpBinding (), new Uri ("http://localhost:37564"));
|
||||
host.AddServiceEndpoint (typeof (TestService2), new BasicHttpBinding (), new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()));
|
||||
|
||||
host.Open ();
|
||||
var ed = ((ChannelDispatcher) host.ChannelDispatchers [0]).Endpoints [0];
|
||||
|
@ -36,6 +36,8 @@ using System.ServiceModel.Description;
|
||||
using System.ServiceModel.Dispatcher;
|
||||
using System.ServiceModel.Channels;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.ServiceModel.Description
|
||||
{
|
||||
[TestFixture]
|
||||
@ -66,7 +68,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
|
||||
[Test]
|
||||
public void InitializeRuntime1 () {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + NetworkHelpers.FindFreePort ()))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "e1");
|
||||
|
||||
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
|
||||
@ -103,7 +105,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
|
||||
[Test]
|
||||
public void InitializeRuntime2 () {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + NetworkHelpers.FindFreePort ()))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
|
||||
host.Description.Behaviors.Remove<ServiceDebugBehavior> ();
|
||||
|
||||
@ -122,7 +124,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
|
||||
[Test]
|
||||
public void InitializeRuntime3 () {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + NetworkHelpers.FindFreePort ()))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageEnabled = false;
|
||||
|
||||
@ -140,9 +142,10 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
|
||||
[Test]
|
||||
public void InitializeRuntime4 () {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
|
||||
int port = NetworkHelpers.FindFreePort ();
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + port))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:37564/help");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:" + port + "/help");
|
||||
|
||||
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
|
||||
|
||||
@ -168,7 +171,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
Assert.AreEqual (0, ed.FilterPriority, "FilterPriority");
|
||||
|
||||
EndpointAddress ea = ed.EndpointAddress;
|
||||
Assert.AreEqual (new Uri ("http://localhost:37564/help"), ea.Uri, "Uri");
|
||||
Assert.AreEqual (new Uri ("http://localhost:" + port + "/help"), ea.Uri, "Uri");
|
||||
|
||||
DispatchRuntime dr = ed.DispatchRuntime;
|
||||
Assert.AreEqual (1, dr.Operations.Count, "Operations.Count");
|
||||
@ -186,9 +189,10 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
|
||||
[Test]
|
||||
public void ServiceMetadataExtension1 () {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
|
||||
int port = NetworkHelpers.FindFreePort ();
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + port))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:37564/help");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:" + port + "/help");
|
||||
try {
|
||||
host.Open ();
|
||||
|
||||
@ -202,9 +206,10 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
|
||||
[Test]
|
||||
public void ServiceMetadataExtension2 () {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:37564"))) {
|
||||
int port = NetworkHelpers.FindFreePort ();
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + port))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = CreateUri ("http://localhost:37564/help");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = CreateUri ("http://localhost:" + port + "/help");
|
||||
|
||||
ServiceMetadataExtension extension = new ServiceMetadataExtension ();
|
||||
host.Extensions.Add (extension);
|
||||
|
@ -35,6 +35,8 @@ using System.ServiceModel.Description;
|
||||
using System.ServiceModel.Dispatcher;
|
||||
using System.ServiceModel.Channels;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.ServiceModel.Description
|
||||
{
|
||||
[TestFixture]
|
||||
@ -58,7 +60,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
[Test]
|
||||
public void ListenUri ()
|
||||
{
|
||||
Uri uri = new Uri ("http://localhost:37564");
|
||||
Uri uri = new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ());
|
||||
var se = new ServiceEndpoint (contract1, null, new EndpointAddress (uri));
|
||||
Assert.AreEqual (uri, se.ListenUri, "#1");
|
||||
}
|
||||
|
Reference in New Issue
Block a user