Permalink
Browse files

Test behavior of escaped chars

  • Loading branch information...
1 parent 72bce98 commit adef8e7068de8a10fc7cc094095ac4b91eeb8792 @mythz mythz committed Dec 23, 2012
@@ -131,6 +131,7 @@
<Compile Include="CompressionTests.cs" />
<Compile Include="ExceptionHandling2Tests.cs" />
<Compile Include="IntegrationTests\MovieSoap11Tests.cs" />
+ <Compile Include="UniqueRequestTests.cs" />
<Compile Include="SendOneWayTests.cs" />
<Compile Include="Support\Services\EndpointAccessService.cs" />
<Compile Include="SwaggerFeatureTests.cs" />
@@ -0,0 +1,60 @@
+using Funq;
+using NUnit.Framework;
+using ServiceStack.Common;
+using ServiceStack.ServiceHost;
+using ServiceStack.Text;
+
+namespace ServiceStack.WebHost.Endpoints.Tests
+{
+ [Route("/request/{Id}")]
+ public class ById
+ {
+ public string Id { get; set; }
+ }
+
+ public class UniqueRequestService : IService
+ {
+ public string Get(ById byId)
+ {
+ return byId.Id;
+ }
+ }
+
+ public class UniqueRequestAppHost : AppHostHttpListenerBase
+ {
+ public UniqueRequestAppHost() : base("Unique Request Tests", typeof(UniqueRequestService).Assembly) {}
+ public override void Configure(Container container) {}
+ }
+
+ [TestFixture]
+ public class UniqueRequestTests
+ {
+ private const string BaseUri = "http://localhost:8000";
+ private UniqueRequestAppHost appHost;
+
+ [TestFixtureSetUp]
+ public void TestFixtureSetUp()
+ {
+ appHost = new UniqueRequestAppHost();
+ appHost.Init();
+ appHost.Start(BaseUri + "/");
+ }
+
+ [TestFixtureTearDown]
+ public void TestFixtureTearDown()
+ {
+ appHost.Dispose();
+ appHost = null;
+ }
+
+ [Test]
+ public void Can_handle_encoded_chars()
+ {
+ var response = BaseUri.CombineWith("request/123%20456").GetStringFromUrl();
+ Assert.That(response, Is.EqualTo("123%20456"));
+ response = BaseUri.CombineWith("request/123%7C456").GetStringFromUrl();
+ Assert.That(response, Is.EqualTo("123%7C456"));
+ }
+
+ }
+}

0 comments on commit adef8e7

Please sign in to comment.