diff options
Diffstat (limited to 'OpenSim/Framework/Servers/Tests')
-rw-r--r-- | OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs | 72 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs | 7 |
2 files changed, 74 insertions, 5 deletions
diff --git a/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs new file mode 100644 index 0000000..aa97f62 --- /dev/null +++ b/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs | |||
@@ -0,0 +1,72 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using NUnit.Framework; | ||
5 | using OpenSim.Data; | ||
6 | using OpenSim.Framework.Servers.HttpServer; | ||
7 | using OpenSim.Tests.Common; | ||
8 | |||
9 | namespace OpenSim.Framework.Servers.Tests | ||
10 | { | ||
11 | [TestFixture] | ||
12 | public class CachedGetAssetStreamHandlerTests | ||
13 | { | ||
14 | private const string ASSETS_PATH = "/assets"; | ||
15 | |||
16 | [Test] | ||
17 | public void TestConstructor() | ||
18 | { | ||
19 | TestHelper.InMethod(); | ||
20 | |||
21 | CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null); | ||
22 | } | ||
23 | |||
24 | [Test] | ||
25 | public void TestGetParams() | ||
26 | { | ||
27 | TestHelper.InMethod(); | ||
28 | |||
29 | CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null); | ||
30 | BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH); | ||
31 | } | ||
32 | |||
33 | [Test] | ||
34 | public void TestSplitParams() | ||
35 | { | ||
36 | TestHelper.InMethod(); | ||
37 | |||
38 | CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null); | ||
39 | BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH); | ||
40 | } | ||
41 | |||
42 | [Test] | ||
43 | public void TestHandleNoParams() | ||
44 | { | ||
45 | TestHelper.InMethod(); | ||
46 | |||
47 | CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null); | ||
48 | |||
49 | BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH); | ||
50 | } | ||
51 | |||
52 | [Test] | ||
53 | public void TestHandleMalformedGuid() | ||
54 | { | ||
55 | TestHelper.InMethod(); | ||
56 | |||
57 | CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null); | ||
58 | |||
59 | BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH); | ||
60 | } | ||
61 | |||
62 | //[Test] | ||
63 | //public void TestHandleFetchMissingAsset() | ||
64 | //{ | ||
65 | |||
66 | // byte[] emptyResult = new byte[] { }; | ||
67 | // CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(null); | ||
68 | |||
69 | // Assert.AreEqual(new string[] { }, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid."); | ||
70 | //} | ||
71 | } | ||
72 | } | ||
diff --git a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs index 157a883..091a944 100644 --- a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs +++ b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs | |||
@@ -11,7 +11,6 @@ namespace OpenSim.Framework.Servers.Tests | |||
11 | [TestFixture] | 11 | [TestFixture] |
12 | public class GetAssetStreamHandlerTests | 12 | public class GetAssetStreamHandlerTests |
13 | { | 13 | { |
14 | private static byte[] EmptyByteArray = new byte[] {}; | ||
15 | private const string ASSETS_PATH = "/assets"; | 14 | private const string ASSETS_PATH = "/assets"; |
16 | 15 | ||
17 | [Test] | 16 | [Test] |
@@ -47,8 +46,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
47 | 46 | ||
48 | GetAssetStreamHandler handler = new GetAssetStreamHandler(null); | 47 | GetAssetStreamHandler handler = new GetAssetStreamHandler(null); |
49 | 48 | ||
50 | Assert.AreEqual(EmptyByteArray, handler.Handle(ASSETS_PATH, null, null, null), "Failed on empty params."); | 49 | BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH); |
51 | Assert.AreEqual(EmptyByteArray, handler.Handle(ASSETS_PATH + "/", null, null, null), "Failed on single slash."); | ||
52 | } | 50 | } |
53 | 51 | ||
54 | [Test] | 52 | [Test] |
@@ -58,13 +56,12 @@ namespace OpenSim.Framework.Servers.Tests | |||
58 | 56 | ||
59 | GetAssetStreamHandler handler = new GetAssetStreamHandler(null); | 57 | GetAssetStreamHandler handler = new GetAssetStreamHandler(null); |
60 | 58 | ||
61 | Assert.AreEqual(EmptyByteArray, handler.Handle(ASSETS_PATH + "/badGuid", null, null, null), "Failed on bad guid."); | 59 | BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH); |
62 | } | 60 | } |
63 | 61 | ||
64 | //[Test] | 62 | //[Test] |
65 | //public void TestHandleFetchMissingAsset() | 63 | //public void TestHandleFetchMissingAsset() |
66 | //{ | 64 | //{ |
67 | |||
68 | // byte[] emptyResult = new byte[] { }; | 65 | // byte[] emptyResult = new byte[] { }; |
69 | // GetAssetStreamHandler handler = new GetAssetStreamHandler(null); | 66 | // GetAssetStreamHandler handler = new GetAssetStreamHandler(null); |
70 | 67 | ||