Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@ -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]
@ -56,7 +58,8 @@ namespace MonoTests.System.ServiceModel.Description
[Test]
public void InitializeRuntime1 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:30158"))) {
var port = NetworkHelpers.FindFreePort ();
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + port))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "e1");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true });
@ -93,10 +96,11 @@ namespace MonoTests.System.ServiceModel.Description
[Test]
public void InitializeRuntime2 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:30158"))) {
var port = NetworkHelpers.FindFreePort ();
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + port))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:30158/mex_and_help") });
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:30158/mex_and_help");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:" + port + "/mex_and_help") });
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:" + port + "/mex_and_help");
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
@ -125,10 +129,11 @@ namespace MonoTests.System.ServiceModel.Description
[Test]
public void InitializeRuntime3 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:30158"))) {
var port = NetworkHelpers.FindFreePort ();
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + port))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:30158/mex") });
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:30158/help");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:" + port + "/mex") });
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:" + port + "/help");
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
@ -176,9 +181,10 @@ namespace MonoTests.System.ServiceModel.Description
[Test]
public void InitializeRuntime4 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:30158"))) {
var port = NetworkHelpers.FindFreePort ();
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + port))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:30158/mex") });
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:" + port + "/mex") });
host.Description.Behaviors.Remove<ServiceDebugBehavior> ();
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
@ -204,7 +210,7 @@ namespace MonoTests.System.ServiceModel.Description
Assert.AreEqual (0, ed.FilterPriority, "FilterPriority");
EndpointAddress ea = ed.EndpointAddress;
Assert.AreEqual (new Uri ("http://localhost:30158/mex"), ea.Uri, "Uri");
Assert.AreEqual (new Uri ("http://localhost:" + port + "/mex"), ea.Uri, "Uri");
DispatchRuntime dr = ed.DispatchRuntime;
Assert.AreEqual (1, dr.Operations.Count, "Operations.Count");
@ -221,9 +227,10 @@ namespace MonoTests.System.ServiceModel.Description
[Test]
public void ServiceMetadataExtension1 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:30158"))) {
var port = NetworkHelpers.FindFreePort ();
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + port))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:30158/mex") });
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:" + port + "/mex") });
host.Description.Behaviors.Remove<ServiceDebugBehavior> ();
host.Open ();
@ -237,9 +244,10 @@ namespace MonoTests.System.ServiceModel.Description
[Test]
public void ServiceMetadataExtension2 () {
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:30158"))) {
var port = NetworkHelpers.FindFreePort ();
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + port))) {
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:30158/mex") });
host.Description.Behaviors.Add (new ServiceMetadataBehavior () { HttpGetEnabled = true, HttpGetUrl = new Uri ("http://localhost:" + port + "/mex") });
host.Description.Behaviors.Remove<ServiceDebugBehavior> ();
ServiceMetadataExtension extension = new ServiceMetadataExtension ();