Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove need for TestHttpNamespace.bat.

The only reason we needed to have TestHttpNamespace.bat is because some tests were taking calls for http://+:50231/ instead of http://localhost:50231/, and this behavior happened only when using HttpSelfHost. Configuring our tests not to take the broader URL space means they don't ever need admin-level access.
  • Loading branch information...
commit c942cabd8a5d280672c288f43fab59e85f11c6da 1 parent bfa28d1
@davidmatson davidmatson authored
View
6 test/System.Web.Http.Integration.Test/ContentNegotiation/CustomFormatterTests.cs
@@ -7,6 +7,7 @@
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
+using System.ServiceModel;
using System.Threading.Tasks;
using System.Web.Http.SelfHost;
using System.Web.Http.Util;
@@ -111,7 +112,10 @@ public void CustomFormatter_Post_Returns_Request_ComplexType_Content()
private void SetupHost()
{
baseAddress = "http://localhost/";
- config = new HttpSelfHostConfiguration(baseAddress);
+ config = new HttpSelfHostConfiguration(baseAddress)
+ {
+ HostNameComparisonMode = HostNameComparisonMode.Exact
+ };
config.Routes.MapHttpRoute("Default", "{controller}/{action}", new { controller = "CustomFormatterTests", action = "EchoOrder" });
config.MessageHandlers.Add(new ConvertToStreamMessageHandler());
config.Formatters.Add(new PlainTextFormatterWithVersionInfo());
View
2  test/System.Web.Http.Integration.Test/ContentNegotiation/HttpResponseReturnTests.cs
@@ -5,6 +5,7 @@
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
+using System.ServiceModel;
using System.Web.Http.SelfHost;
using System.Web.Http.Util;
using Microsoft.TestCommon;
@@ -80,6 +81,7 @@ public void SetupHost()
baseAddress = "http://localhost/";
HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(baseAddress);
+ config.HostNameComparisonMode = HostNameComparisonMode.Exact;
config.Routes.MapHttpRoute("Default", "{controller}/{action}", new { controller = "HttpResponseReturn" });
config.MessageHandlers.Add(new ConvertToStreamMessageHandler());
View
2  test/System.Web.Http.Integration.Test/ModelBinding/HttpContentBindingTests.cs
@@ -4,6 +4,7 @@
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
+using System.ServiceModel;
using System.Web.Http.SelfHost;
using System.Web.Http.Util;
using Microsoft.TestCommon;
@@ -52,6 +53,7 @@ private void SetupHost()
baseAddress = "http://localhost/";
HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(baseAddress);
+ config.HostNameComparisonMode = HostNameComparisonMode.Exact;
config.Routes.MapHttpRoute("Default", "{controller}/{action}", new { controller = "HttpContentBinding", action = "HandleMessage" });
config.MessageHandlers.Add(new ConvertToStreamMessageHandler());
View
2  test/System.Web.Http.SelfHost.Test/Authentication/BasicOverHttpTest.cs
@@ -2,6 +2,7 @@
using System.Net;
using System.Net.Http;
+using System.ServiceModel;
using System.Web.Http.SelfHost;
using Microsoft.TestCommon;
@@ -39,6 +40,7 @@ private static void RunBasicAuthTest(string controllerName, string routeSuffix,
{
// Arrange
HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(BaseAddress);
+ config.HostNameComparisonMode = HostNameComparisonMode.Exact;
config.Routes.MapHttpRoute("Default", "{controller}" + routeSuffix, new { controller = controllerName });
config.UserNamePasswordValidator = new CustomUsernamePasswordValidator();
config.MessageHandlers.Add(new CustomMessageHandler());
View
2  test/System.Web.Http.SelfHost.Test/DeeplyNestedTypeTests.cs
@@ -4,6 +4,7 @@
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
+using System.ServiceModel;
using System.Text;
using System.Xml.Linq;
using Microsoft.TestCommon;
@@ -27,6 +28,7 @@ public void SetupHost()
baseAddress = String.Format("http://localhost/");
HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(baseAddress);
+ config.HostNameComparisonMode = HostNameComparisonMode.Exact;
config.Routes.MapHttpRoute("Default", "{controller}/{action}", new { controller = "DeepNestedType" });
server = new HttpSelfHostServer(config);
View
2  test/System.Web.Http.SelfHost.Test/HttpSelfHostResponseTest.cs
@@ -5,6 +5,7 @@
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
+using System.ServiceModel;
using System.Threading.Tasks;
using Microsoft.TestCommon;
@@ -27,6 +28,7 @@ public void SetupHost()
baseAddress = String.Format("http://localhost:{0}/", HttpSelfHostServerTest.TestPort);
HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(baseAddress);
+ config.HostNameComparisonMode = HostNameComparisonMode.Exact;
config.Routes.MapHttpRoute("Default", "{controller}/{action}", new { controller = "NullResponse" });
messageHandler = new NullResponseMessageHandler();
View
1  test/System.Web.Http.SelfHost.Test/HttpSelfHostServerTest.cs
@@ -242,6 +242,7 @@ protected override Task SerializeToStreamAsync(Stream stream, TransportContext c
private static HttpSelfHostServer CreateServer(TransferMode transferMode)
{
HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(BaseUri(transferMode));
+ config.HostNameComparisonMode = HostNameComparisonMode.Exact;
config.Routes.MapHttpRoute("Default", "{controller}/{action}");
config.TransferMode = transferMode;
View
27 tools/TestHttpNamespace.bat
@@ -1,27 +0,0 @@
-@ECHO OFF
-:CHECKFORSWITCHES
-IF '%1'=='/h' GOTO DISPINFO
-IF '%1'=='/H' GOTO DISPINFO
-IF '%1'=='/?' GOTO DISPINFO
-IF '%1'=='/register' GOTO REGISTER
-IF '%1'=='/unregister' GOTO UNREGISTER
-IF '%1'=='/REGISTER' GOTO REGISTER
-IF '%1'=='/UNREGISTER' GOTO UNREGISTER
-
-GOTO DISPINFO
-
-:REGISTER
-netsh http add urlacl http://+:50231/ user=%USERDOMAIN%\%USERNAME%
-GOTO END
-
-:UNREGISTER
-netsh http delete urlacl http://+:50231/
-GOTO END
-
-:DISPINFO
-ECHO Reserve/Unreserve http.sys url's used by aspnetwebstack unit tests
-ECHO.
-ECHO Syntax: TestHttpNamespace [/register] [/unregister] [/h]
-GOTO END
-
-:END
Please sign in to comment.
Something went wrong with that request. Please try again.