diff options
Diffstat (limited to 'OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs')
-rw-r--r-- | OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs index d399274..0b70cb1 100644 --- a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs +++ b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs | |||
@@ -2,12 +2,13 @@ | |||
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.Data; | ||
5 | 6 | ||
6 | namespace OpenSim.Framework.Servers.Tests | 7 | namespace OpenSim.Framework.Servers.Tests |
7 | { | 8 | { |
8 | [TestFixture] | 9 | [TestFixture] |
9 | public class GetAssetStreamHandlerTests | 10 | public class GetAssetStreamHandlerTests |
10 | { | 11 | { |
11 | [Test] | 12 | [Test] |
12 | public void TestConstructor() | 13 | public void TestConstructor() |
13 | { | 14 | { |
@@ -19,6 +20,11 @@ namespace OpenSim.Framework.Servers.Tests | |||
19 | { | 20 | { |
20 | GetAssetStreamHandler handler = new GetAssetStreamHandler(null); | 21 | GetAssetStreamHandler handler = new GetAssetStreamHandler(null); |
21 | 22 | ||
23 | Assert.AreEqual("", handler.GetParam(null), "Failed on null path."); | ||
24 | Assert.AreEqual("", handler.GetParam(""), "Failed on empty path."); | ||
25 | Assert.AreEqual("", handler.GetParam("s"), "Failed on short url."); | ||
26 | Assert.AreEqual("", handler.GetParam("corruptUrl"), "Failed on corruptUrl."); | ||
27 | |||
22 | Assert.AreEqual("", handler.GetParam("/assets")); | 28 | Assert.AreEqual("", handler.GetParam("/assets")); |
23 | Assert.AreEqual("/", handler.GetParam("/assets/")); | 29 | Assert.AreEqual("/", handler.GetParam("/assets/")); |
24 | Assert.AreEqual("/a", handler.GetParam("/assets/a")); | 30 | Assert.AreEqual("/a", handler.GetParam("/assets/a")); |
@@ -32,11 +38,45 @@ namespace OpenSim.Framework.Servers.Tests | |||
32 | { | 38 | { |
33 | GetAssetStreamHandler handler = new GetAssetStreamHandler(null); | 39 | GetAssetStreamHandler handler = new GetAssetStreamHandler(null); |
34 | 40 | ||
41 | Assert.AreEqual(new string[] { }, handler.SplitParams(null), "Failed on null."); | ||
42 | Assert.AreEqual(new string[] { }, handler.SplitParams(""), "Failed on empty path."); | ||
43 | Assert.AreEqual(new string[] { }, handler.SplitParams("corruptUrl"), "Failed on corrupt url."); | ||
44 | |||
35 | Assert.AreEqual(new string[] { }, handler.SplitParams("/assets"), "Failed on empty params."); | 45 | Assert.AreEqual(new string[] { }, handler.SplitParams("/assets"), "Failed on empty params."); |
36 | Assert.AreEqual(new string[] { }, handler.SplitParams("/assets/"), "Failed on single slash."); | 46 | Assert.AreEqual(new string[] { }, handler.SplitParams("/assets/"), "Failed on single slash."); |
37 | Assert.AreEqual(new string[] { "a" }, handler.SplitParams("/assets/a"), "Failed on first segment."); | 47 | Assert.AreEqual(new string[] { "a" }, handler.SplitParams("/assets/a"), "Failed on first segment."); |
38 | Assert.AreEqual(new string[] { "b" }, handler.SplitParams("/assets/b/"), "Failed on second slash."); | 48 | Assert.AreEqual(new string[] { "b" }, handler.SplitParams("/assets/b/"), "Failed on second slash."); |
49 | Assert.AreEqual(new string[] { "c", "d" }, handler.SplitParams("/assets/c/d"), "Failed on second segment."); | ||
50 | Assert.AreEqual(new string[] { "e", "f" }, handler.SplitParams("/assets/e/f/"), "Failed on trailing slash."); | ||
51 | } | ||
52 | |||
53 | [Test] | ||
54 | public void TestHandleNoParams() | ||
55 | { | ||
56 | byte[] emptyResult = new byte[] {}; | ||
57 | GetAssetStreamHandler handler = new GetAssetStreamHandler(null); | ||
58 | |||
59 | Assert.AreEqual(new string[] { }, handler.Handle("/assets", null, null, null), "Failed on empty params."); | ||
60 | Assert.AreEqual(new string[] { }, handler.Handle("/assets/", null, null, null ), "Failed on single slash."); | ||
39 | } | 61 | } |
40 | 62 | ||
63 | [Test] | ||
64 | public void TestHandleMalformedGuid() | ||
65 | { | ||
66 | byte[] emptyResult = new byte[] {}; | ||
67 | GetAssetStreamHandler handler = new GetAssetStreamHandler(null); | ||
68 | |||
69 | Assert.AreEqual(new string[] {}, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid."); | ||
70 | } | ||
71 | |||
72 | //[Test] | ||
73 | //public void TestHandleFetchMissingAsset() | ||
74 | //{ | ||
75 | |||
76 | // byte[] emptyResult = new byte[] { }; | ||
77 | // GetAssetStreamHandler handler = new GetAssetStreamHandler(null); | ||
78 | |||
79 | // Assert.AreEqual(new string[] { }, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid."); | ||
80 | //} | ||
41 | } | 81 | } |
42 | } | 82 | } |