Merge pull request #2698 from esdrubal/iosxmlarray
[mono.git] / mcs / class / System.ServiceModel.Web / Test / System.ServiceModel.Dispatcher / WebHttpDispatchOperationSelectorTest.cs
index 4507383fdd0dedfc676935542c3e6830cc837349..d99036dfdbde7bac5fd3dffce71cd67cd3371398 100644 (file)
@@ -5,6 +5,7 @@
 //     Atsushi Enomoto  <atsushi@ximian.com>
 //
 // Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -25,6 +26,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+#if !MOBILE
 using System;
 using System.Globalization;
 using System.Runtime.Serialization;
@@ -37,6 +39,8 @@ using System.Text;
 using System.Xml;
 using NUnit.Framework;
 
+using MonoTests.Helpers;
+
 namespace MonoTests.System.ServiceModel.Dispatcher
 {
        [TestFixture]
@@ -255,12 +259,13 @@ namespace MonoTests.System.ServiceModel.Dispatcher
                public void WebMessageFormats ()
                {
                        var host = new WebServiceHost (typeof (Hello));
-                       host.AddServiceEndpoint (typeof (IHello), new WebHttpBinding (), "http://localhost:37564/");
+                       var port = NetworkHelpers.FindFreePort ();
+                       host.AddServiceEndpoint (typeof (IHello), new WebHttpBinding (), "http://localhost:" + port + "/");
                        host.Description.Behaviors.Find<ServiceDebugBehavior> ().IncludeExceptionDetailInFaults = true;
                        host.Open ();
                        try {
                                // run client
-                               using (ChannelFactory<IHello> factory = new ChannelFactory<IHello> (new WebHttpBinding (), "http://localhost:37564/"))
+                               using (ChannelFactory<IHello> factory = new ChannelFactory<IHello> (new WebHttpBinding (), "http://localhost:" + port + "/"))
                                {
                                        factory.Endpoint.Behaviors.Add (new WebHttpBehavior ());
                                        IHello h = factory.CreateChannel ();
@@ -275,3 +280,4 @@ namespace MonoTests.System.ServiceModel.Dispatcher
                #endregion
        }
 }
+#endif
\ No newline at end of file