Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@ -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);