29 using System.Collections.Generic;
31 using NUnit.Framework;
32 using OpenSim.Framework;
33 using OpenSim.Framework.Servers;
34 using OpenSim.Framework.Servers.HttpServer;
36 namespace OpenSim.Tests.Common
40 private static string[] m_emptyStringArray =
new string[] { };
44 Assert.AreEqual(String.Empty, handler.GetParam(null),
"Failed on null path.");
45 Assert.AreEqual(String.Empty, handler.GetParam(
""),
"Failed on empty path.");
46 Assert.AreEqual(String.Empty, handler.GetParam(
"s"),
"Failed on short url.");
47 Assert.AreEqual(String.Empty, handler.GetParam(
"corruptUrl"),
"Failed on corruptUrl.");
49 Assert.AreEqual(String.Empty, handler.GetParam(assetsPath));
50 Assert.AreEqual(
"/", handler.GetParam(assetsPath +
"/"));
51 Assert.AreEqual(
"/a", handler.GetParam(assetsPath +
"/a"));
52 Assert.AreEqual(
"/b/", handler.GetParam(assetsPath +
"/b/"));
53 Assert.AreEqual(
"/c/d", handler.GetParam(assetsPath +
"/c/d"));
54 Assert.AreEqual(
"/e/f/", handler.GetParam(assetsPath +
"/e/f/"));
59 Assert.AreEqual(m_emptyStringArray, handler.SplitParams(null),
"Failed on null.");
60 Assert.AreEqual(m_emptyStringArray, handler.SplitParams(
""),
"Failed on empty path.");
61 Assert.AreEqual(m_emptyStringArray, handler.SplitParams(
"corruptUrl"),
"Failed on corrupt url.");
63 Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath),
"Failed on empty params.");
64 Assert.AreEqual(m_emptyStringArray, handler.SplitParams(assetsPath +
"/"),
"Failed on single slash.");
66 Assert.AreEqual(
new string[] {
"a" }, handler.SplitParams(assetsPath +
"/a"),
"Failed on first segment.");
67 Assert.AreEqual(
new string[] {
"b" }, handler.SplitParams(assetsPath +
"/b/"),
"Failed on second slash.");
68 Assert.AreEqual(
new string[] {
"c",
"d" }, handler.SplitParams(assetsPath +
"/c/d"),
"Failed on second segment.");
69 Assert.AreEqual(
new string[] {
"e",
"f" }, handler.SplitParams(assetsPath +
"/e/f/"),
"Failed on trailing slash.");
72 public static byte[] EmptyByteArray =
new byte[] {};
static void BaseTestSplitParams(BaseRequestHandler handler, string assetsPath)
static void BaseTestGetParams(BaseRequestHandler handler, string assetsPath)