forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEndpointHandlerBaseTests.cs
More file actions
36 lines (33 loc) · 1.15 KB
/
EndpointHandlerBaseTests.cs
File metadata and controls
36 lines (33 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Web;
using NUnit.Framework;
using ServiceStack.Common.Web;
using ServiceStack.ServiceHost;
using ServiceStack.ServiceInterface.Testing;
using ServiceStack.Text;
using ServiceStack.WebHost.Endpoints;
using ServiceStack.WebHost.Endpoints.Handlers;
namespace ServiceStack.Common.Tests
{
[TestFixture]
public class EndpointHandlerBaseTests
{
public IHttpRequest CreateRequest(string userHostAddress)
{
var httpReq = new MockHttpRequest("test", HttpMethods.Get, ContentType.Json, "/", null, null, null)
{
UserHostAddress = userHostAddress,
IsLocal = false
};
return httpReq;
}
[Test]
public void Can_parse_Ips()
{
var handler = new AsyncRestHandler(new RestPath(typeof(object), "/test"));
var result = handler.GetEndpointAttributes(CreateRequest("204.2.145.235"));
Assert.That(result.Has(EndpointAttributes.External));
Assert.That(result.Has(EndpointAttributes.HttpGet));
Assert.That(result.Has(EndpointAttributes.InSecure));
}
}
}