aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
authorlbsa712009-05-08 06:11:44 +0000
committerlbsa712009-05-08 06:11:44 +0000
commit8ac73be9178ac9b7445534522f5b574df29fa560 (patch)
tree04307ff1fa089c38e50d684aa996e1fd2b449e1c /OpenSim/Tests
parentThanks lulurun for a patch which addresses Mantis #3599: Exceptions when Asse... (diff)
downloadopensim-SC_OLD-8ac73be9178ac9b7445534522f5b574df29fa560.zip
opensim-SC_OLD-8ac73be9178ac9b7445534522f5b574df29fa560.tar.gz
opensim-SC_OLD-8ac73be9178ac9b7445534522f5b574df29fa560.tar.bz2
opensim-SC_OLD-8ac73be9178ac9b7445534522f5b574df29fa560.tar.xz
* Introduced new HttpServer.Tests project
* Split the GetAssetStreamHandler testing into separate tests for BaseRequestHandler * Ignored some gens
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/Common/BaseRequestHandlerTestHelper.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Tests/Common/BaseRequestHandlerTestHelper.cs b/OpenSim/Tests/Common/BaseRequestHandlerTestHelper.cs
new file mode 100644
index 0000000..4052920
--- /dev/null
+++ b/OpenSim/Tests/Common/BaseRequestHandlerTestHelper.cs
@@ -0,0 +1,44 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using NUnit.Framework;
5using OpenSim.Framework.Servers;
6using OpenSim.Framework.Servers.HttpServer;
7
8namespace OpenSim.Tests.Common
9{
10 public class BaseRequestHandlerTestHelper
11 {
12 private static string[] m_emptyStringArray = new string[] { };
13
14 public static void BaseTestGetParams(BaseRequestHandler handler, string assetsPath)
15 {
16 Assert.AreEqual(String.Empty, handler.GetParam(null), "Failed on null path.");
17 Assert.AreEqual(String.Empty, handler.GetParam(""), "Failed on empty path.");
18 Assert.AreEqual(String.Empty, handler.GetParam("s"), "Failed on short url.");
19 Assert.AreEqual(String.Empty, handler.GetParam("corruptUrl"), "Failed on corruptUrl.");
20
21 Assert.AreEqual(String.Empty, handler.GetParam(assetsPath));
22 Assert.AreEqual("/", handler.GetParam(assetsPath + "/"));
23 Assert.AreEqual("/a", handler.GetParam(assetsPath + "/a"));
24 Assert.AreEqual("/b/", handler.GetParam(assetsPath + "/b/"));
25 Assert.AreEqual("/c/d", handler.GetParam(assetsPath + "/c/d"));
26 Assert.AreEqual("/e/f/", handler.GetParam(assetsPath + "/e/f/"));
27 }
28
29 public static void BaseTestSplitParams(BaseRequestHandler handler, string assetsPath)
30 {
31 Assert.AreEqual(m_emptyStringArray, handler.SplitParams(null), "Failed on null.");
32 Assert.AreEqual(m_emptyStringArray, handler.SplitParams(""), "Failed on empty path.");
33 Assert.AreEqual(m_emptyStringArray, handler.SplitParams("corruptUrl"), "Failed on corrupt url.");
34
35 Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath), "Failed on empty params.");
36 Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath + "/"), "Failed on single slash.");
37
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.");
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.");
42 }
43 }
44}