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