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
45 lines (40 loc) · 1.19 KB
/
Copy pathEndpointHandlerBaseTests.cs
File metadata and controls
45 lines (40 loc) · 1.19 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
37
38
39
40
41
42
43
44
45
using System;
using NUnit.Framework;
using ServiceStack.Testing;
using ServiceStack.Text;
using ServiceStack.Web;
namespace ServiceStack.Common.Tests
{
[TestFixture]
public class EndpointHandlerBaseTests
{
public IHttpRequest CreateRequest(string userHostAddress)
{
var httpReq = new MockHttpRequest("test", HttpMethods.Get, MimeTypes.Json, "/", null, null, null)
{
UserHostAddress = userHostAddress
};
return httpReq;
}
[Test]
public void Can_parse_Ips()
{
using (new BasicAppHost().Init())
{
var result = CreateRequest("204.2.145.235").GetAttributes();
Assert.That(result.Has(RequestAttributes.External));
Assert.That(result.Has(RequestAttributes.HttpGet));
Assert.That(result.Has(RequestAttributes.InSecure));
}
}
[Flags]
enum A : int { B = 0, C = 2, D = 4 }
[Test]
public void Can_parse_int_enums()
{
var result = A.B | A.C;
Assert.That(result.Has(A.C));
Assert.That(!result.Has(A.D));
}
}
}