forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServiceStackHttpHandlerFactoryTests.cs
More file actions
62 lines (52 loc) · 1.91 KB
/
ServiceStackHttpHandlerFactoryTests.cs
File metadata and controls
62 lines (52 loc) · 1.91 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using NUnit.Framework;
using ServiceStack.WebHost.Endpoints.Metadata;
using ServiceStack.WebHost.Endpoints.Handlers;
namespace ServiceStack.WebHost.Endpoints.Tests
{
[TestFixture, Ignore]
public class ServiceStackHttpHandlerFactoryTests
{
readonly Dictionary<string, Type> pathInfoMap = new Dictionary<string, Type>
{
{"Metadata", typeof(IndexMetadataHandler)},
{"Soap11", typeof(AsyncSoapHandler)},
{"Soap12", typeof(AsyncSoapHandler)},
{"Json/SyncReply", typeof(AsyncRestHandler)},
{"Json/AsyncOneWay", typeof(AsyncRestHandler)},
{"Json/Metadata", typeof(JsonMetadataHandler)},
{"Xml/SyncReply", typeof(AsyncRestHandler)},
{"Xml/AsyncOneWay", typeof(AsyncRestHandler)},
{"Xml/Metadata", typeof(XmlMetadataHandler)},
{"Jsv/SyncReply", typeof(AsyncRestHandler)},
{"Jsv/AsyncOneWay", typeof(AsyncRestHandler)},
{"Jsv/Metadata", typeof(JsvMetadataHandler)},
{"Soap11/Wsdl", typeof(Soap11WsdlMetadataHandler)},
{"Soap11/Metadata", typeof(Soap11MetadataHandler)},
{"Soap12/Wsdl", typeof(Soap12WsdlMetadataHandler)},
{"Soap12/Metadata", typeof(Soap12MetadataHandler)},
};
[Test]
public void Resolves_the_right_handler_for_expexted_paths()
{
foreach (var item in pathInfoMap)
{
var expectedType = item.Value;
var handler = ServiceStackHttpHandlerFactory.GetHandlerForPathInfo(null, item.Key, null, null);
Assert.That(handler.GetType(), Is.EqualTo(expectedType));
}
}
[Test]
public void Resolves_the_right_handler_for_case_insensitive_expexted_paths()
{
foreach (var item in pathInfoMap)
{
var expectedType = item.Value;
var lowerPathInfo = item.Key.ToLower();
var handler = ServiceStackHttpHandlerFactory.GetHandlerForPathInfo(null, lowerPathInfo, null, null);
Assert.That(handler.GetType(), Is.EqualTo(expectedType));
}
}
}
}