diff options
Diffstat (limited to 'OpenSim/Tests/Common')
-rw-r--r-- | OpenSim/Tests/Common/BaseRequestHandlerTestHelper.cs | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/OpenSim/Tests/Common/BaseRequestHandlerTestHelper.cs b/OpenSim/Tests/Common/BaseRequestHandlerTestHelper.cs index 7e91fde..8f96fb3 100644 --- a/OpenSim/Tests/Common/BaseRequestHandlerTestHelper.cs +++ b/OpenSim/Tests/Common/BaseRequestHandlerTestHelper.cs | |||
@@ -1,57 +1,57 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using NUnit.Framework; | 4 | using NUnit.Framework; |
5 | using OpenSim.Framework.Servers; | 5 | using OpenSim.Framework.Servers; |
6 | using OpenSim.Framework.Servers.HttpServer; | 6 | using OpenSim.Framework.Servers.HttpServer; |
7 | 7 | ||
8 | namespace OpenSim.Tests.Common | 8 | namespace OpenSim.Tests.Common |
9 | { | 9 | { |
10 | public class BaseRequestHandlerTestHelper | 10 | public class BaseRequestHandlerTestHelper |
11 | { | 11 | { |
12 | private static string[] m_emptyStringArray = new string[] { }; | 12 | private static string[] m_emptyStringArray = new string[] { }; |
13 | 13 | ||
14 | public static void BaseTestGetParams(BaseRequestHandler handler, string assetsPath) | 14 | public static void BaseTestGetParams(BaseRequestHandler handler, string assetsPath) |
15 | { | 15 | { |
16 | Assert.AreEqual(String.Empty, handler.GetParam(null), "Failed on null path."); | 16 | Assert.AreEqual(String.Empty, handler.GetParam(null), "Failed on null path."); |
17 | Assert.AreEqual(String.Empty, handler.GetParam(""), "Failed on empty path."); | 17 | Assert.AreEqual(String.Empty, handler.GetParam(""), "Failed on empty path."); |
18 | Assert.AreEqual(String.Empty, handler.GetParam("s"), "Failed on short url."); | 18 | Assert.AreEqual(String.Empty, handler.GetParam("s"), "Failed on short url."); |
19 | Assert.AreEqual(String.Empty, handler.GetParam("corruptUrl"), "Failed on corruptUrl."); | 19 | Assert.AreEqual(String.Empty, handler.GetParam("corruptUrl"), "Failed on corruptUrl."); |
20 | 20 | ||
21 | Assert.AreEqual(String.Empty, handler.GetParam(assetsPath)); | 21 | Assert.AreEqual(String.Empty, handler.GetParam(assetsPath)); |
22 | Assert.AreEqual("/", handler.GetParam(assetsPath + "/")); | 22 | Assert.AreEqual("/", handler.GetParam(assetsPath + "/")); |
23 | Assert.AreEqual("/a", handler.GetParam(assetsPath + "/a")); | 23 | Assert.AreEqual("/a", handler.GetParam(assetsPath + "/a")); |
24 | Assert.AreEqual("/b/", handler.GetParam(assetsPath + "/b/")); | 24 | Assert.AreEqual("/b/", handler.GetParam(assetsPath + "/b/")); |
25 | Assert.AreEqual("/c/d", handler.GetParam(assetsPath + "/c/d")); | 25 | Assert.AreEqual("/c/d", handler.GetParam(assetsPath + "/c/d")); |
26 | Assert.AreEqual("/e/f/", handler.GetParam(assetsPath + "/e/f/")); | 26 | Assert.AreEqual("/e/f/", handler.GetParam(assetsPath + "/e/f/")); |
27 | } | 27 | } |
28 | 28 | ||
29 | public static void BaseTestSplitParams(BaseRequestHandler handler, string assetsPath) | 29 | public static void BaseTestSplitParams(BaseRequestHandler handler, string assetsPath) |
30 | { | 30 | { |
31 | Assert.AreEqual(m_emptyStringArray, handler.SplitParams(null), "Failed on null."); | 31 | Assert.AreEqual(m_emptyStringArray, handler.SplitParams(null), "Failed on null."); |
32 | Assert.AreEqual(m_emptyStringArray, handler.SplitParams(""), "Failed on empty path."); | 32 | Assert.AreEqual(m_emptyStringArray, handler.SplitParams(""), "Failed on empty path."); |
33 | Assert.AreEqual(m_emptyStringArray, handler.SplitParams("corruptUrl"), "Failed on corrupt url."); | 33 | Assert.AreEqual(m_emptyStringArray, handler.SplitParams("corruptUrl"), "Failed on corrupt url."); |
34 | 34 | ||
35 | Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath), "Failed on empty params."); | 35 | Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath), "Failed on empty params."); |
36 | Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath + "/"), "Failed on single slash."); | 36 | Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath + "/"), "Failed on single slash."); |
37 | 37 | ||
38 | Assert.AreEqual(new string[] { "a" }, handler.SplitParams(assetsPath + "/a"), "Failed on first segment."); | 38 | Assert.AreEqual(new string[] { "a" }, handler.SplitParams(assetsPath + "/a"), "Failed on first segment."); |
39 | Assert.AreEqual(new string[] { "b" }, handler.SplitParams(assetsPath + "/b/"), "Failed on second slash."); | 39 | Assert.AreEqual(new string[] { "b" }, handler.SplitParams(assetsPath + "/b/"), "Failed on second slash."); |
40 | Assert.AreEqual(new string[] { "c", "d" }, handler.SplitParams(assetsPath + "/c/d"), "Failed on second segment."); | 40 | Assert.AreEqual(new string[] { "c", "d" }, handler.SplitParams(assetsPath + "/c/d"), "Failed on second segment."); |
41 | Assert.AreEqual(new string[] { "e", "f" }, handler.SplitParams(assetsPath + "/e/f/"), "Failed on trailing slash."); | 41 | Assert.AreEqual(new string[] { "e", "f" }, handler.SplitParams(assetsPath + "/e/f/"), "Failed on trailing slash."); |
42 | } | 42 | } |
43 | 43 | ||
44 | public static byte[] EmptyByteArray = new byte[] {}; | 44 | public static byte[] EmptyByteArray = new byte[] {}; |
45 | 45 | ||
46 | public static void BaseTestHandleNoParams(BaseGetAssetStreamHandler handler, string assetsPath) | 46 | public static void BaseTestHandleNoParams(BaseGetAssetStreamHandler handler, string assetsPath) |
47 | { | 47 | { |
48 | Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath, null, null, null), "Failed on empty params."); | 48 | Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath, null, null, null), "Failed on empty params."); |
49 | Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath + "/", null, null, null), "Failed on single slash."); | 49 | Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath + "/", null, null, null), "Failed on single slash."); |
50 | } | 50 | } |
51 | 51 | ||
52 | public static void BaseTestHandleMalformedGuid(BaseGetAssetStreamHandler handler, string assetsPath) | 52 | public static void BaseTestHandleMalformedGuid(BaseGetAssetStreamHandler handler, string assetsPath) |
53 | { | 53 | { |
54 | Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath + "/badGuid", null, null, null), "Failed on bad guid."); | 54 | Assert.AreEqual(EmptyByteArray, handler.Handle(assetsPath + "/badGuid", null, null, null), "Failed on bad guid."); |
55 | } | 55 | } |
56 | } | 56 | } |
57 | } | 57 | } |