aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs186
1 files changed, 93 insertions, 93 deletions
diff --git a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs
index 702e66a..d3a0368 100644
--- a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs
+++ b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs
@@ -1,93 +1,93 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using NUnit.Framework; 4using NUnit.Framework;
5using OpenSim.Data; 5using OpenSim.Data;
6using OpenSim.Tests.Common; 6using OpenSim.Tests.Common;
7 7
8namespace OpenSim.Framework.Servers.Tests 8namespace OpenSim.Framework.Servers.Tests
9{ 9{
10 [TestFixture] 10 [TestFixture]
11 public class GetAssetStreamHandlerTests 11 public class GetAssetStreamHandlerTests
12 { 12 {
13 [Test] 13 [Test]
14 public void TestConstructor() 14 public void TestConstructor()
15 { 15 {
16 TestHelper.InMethod(); 16 TestHelper.InMethod();
17 17
18 GetAssetStreamHandler handler = new GetAssetStreamHandler( null ); 18 GetAssetStreamHandler handler = new GetAssetStreamHandler( null );
19 } 19 }
20 20
21 [Test] 21 [Test]
22 public void TestGetParams() 22 public void TestGetParams()
23 { 23 {
24 TestHelper.InMethod(); 24 TestHelper.InMethod();
25 25
26 GetAssetStreamHandler handler = new GetAssetStreamHandler(null); 26 GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
27 27
28 Assert.AreEqual("", handler.GetParam(null), "Failed on null path."); 28 Assert.AreEqual("", handler.GetParam(null), "Failed on null path.");
29 Assert.AreEqual("", handler.GetParam(""), "Failed on empty path."); 29 Assert.AreEqual("", handler.GetParam(""), "Failed on empty path.");
30 Assert.AreEqual("", handler.GetParam("s"), "Failed on short url."); 30 Assert.AreEqual("", handler.GetParam("s"), "Failed on short url.");
31 Assert.AreEqual("", handler.GetParam("corruptUrl"), "Failed on corruptUrl."); 31 Assert.AreEqual("", handler.GetParam("corruptUrl"), "Failed on corruptUrl.");
32 32
33 Assert.AreEqual("", handler.GetParam("/assets")); 33 Assert.AreEqual("", handler.GetParam("/assets"));
34 Assert.AreEqual("/", handler.GetParam("/assets/")); 34 Assert.AreEqual("/", handler.GetParam("/assets/"));
35 Assert.AreEqual("/a", handler.GetParam("/assets/a")); 35 Assert.AreEqual("/a", handler.GetParam("/assets/a"));
36 Assert.AreEqual("/b/", handler.GetParam("/assets/b/")); 36 Assert.AreEqual("/b/", handler.GetParam("/assets/b/"));
37 Assert.AreEqual("/c/d", handler.GetParam("/assets/c/d")); 37 Assert.AreEqual("/c/d", handler.GetParam("/assets/c/d"));
38 Assert.AreEqual("/e/f/", handler.GetParam("/assets/e/f/")); 38 Assert.AreEqual("/e/f/", handler.GetParam("/assets/e/f/"));
39 } 39 }
40 40
41 [Test] 41 [Test]
42 public void TestSplitParams() 42 public void TestSplitParams()
43 { 43 {
44 TestHelper.InMethod(); 44 TestHelper.InMethod();
45 45
46 GetAssetStreamHandler handler = new GetAssetStreamHandler(null); 46 GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
47 47
48 Assert.AreEqual(new string[] { }, handler.SplitParams(null), "Failed on null."); 48 Assert.AreEqual(new string[] { }, handler.SplitParams(null), "Failed on null.");
49 Assert.AreEqual(new string[] { }, handler.SplitParams(""), "Failed on empty path."); 49 Assert.AreEqual(new string[] { }, handler.SplitParams(""), "Failed on empty path.");
50 Assert.AreEqual(new string[] { }, handler.SplitParams("corruptUrl"), "Failed on corrupt url."); 50 Assert.AreEqual(new string[] { }, handler.SplitParams("corruptUrl"), "Failed on corrupt url.");
51 51
52 Assert.AreEqual(new string[] { }, handler.SplitParams("/assets"), "Failed on empty params."); 52 Assert.AreEqual(new string[] { }, handler.SplitParams("/assets"), "Failed on empty params.");
53 Assert.AreEqual(new string[] { }, handler.SplitParams("/assets/"), "Failed on single slash."); 53 Assert.AreEqual(new string[] { }, handler.SplitParams("/assets/"), "Failed on single slash.");
54 Assert.AreEqual(new string[] { "a" }, handler.SplitParams("/assets/a"), "Failed on first segment."); 54 Assert.AreEqual(new string[] { "a" }, handler.SplitParams("/assets/a"), "Failed on first segment.");
55 Assert.AreEqual(new string[] { "b" }, handler.SplitParams("/assets/b/"), "Failed on second slash."); 55 Assert.AreEqual(new string[] { "b" }, handler.SplitParams("/assets/b/"), "Failed on second slash.");
56 Assert.AreEqual(new string[] { "c", "d" }, handler.SplitParams("/assets/c/d"), "Failed on second segment."); 56 Assert.AreEqual(new string[] { "c", "d" }, handler.SplitParams("/assets/c/d"), "Failed on second segment.");
57 Assert.AreEqual(new string[] { "e", "f" }, handler.SplitParams("/assets/e/f/"), "Failed on trailing slash."); 57 Assert.AreEqual(new string[] { "e", "f" }, handler.SplitParams("/assets/e/f/"), "Failed on trailing slash.");
58 } 58 }
59 59
60 [Test] 60 [Test]
61 public void TestHandleNoParams() 61 public void TestHandleNoParams()
62 { 62 {
63 TestHelper.InMethod(); 63 TestHelper.InMethod();
64 64
65 byte[] emptyResult = new byte[] {}; 65 byte[] emptyResult = new byte[] {};
66 GetAssetStreamHandler handler = new GetAssetStreamHandler(null); 66 GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
67 67
68 Assert.AreEqual(new string[] { }, handler.Handle("/assets", null, null, null), "Failed on empty params."); 68 Assert.AreEqual(new string[] { }, handler.Handle("/assets", null, null, null), "Failed on empty params.");
69 Assert.AreEqual(new string[] { }, handler.Handle("/assets/", null, null, null ), "Failed on single slash."); 69 Assert.AreEqual(new string[] { }, handler.Handle("/assets/", null, null, null ), "Failed on single slash.");
70 } 70 }
71 71
72 [Test] 72 [Test]
73 public void TestHandleMalformedGuid() 73 public void TestHandleMalformedGuid()
74 { 74 {
75 TestHelper.InMethod(); 75 TestHelper.InMethod();
76 76
77 byte[] emptyResult = new byte[] {}; 77 byte[] emptyResult = new byte[] {};
78 GetAssetStreamHandler handler = new GetAssetStreamHandler(null); 78 GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
79 79
80 Assert.AreEqual(new string[] {}, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid."); 80 Assert.AreEqual(new string[] {}, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid.");
81 } 81 }
82 82
83 //[Test] 83 //[Test]
84 //public void TestHandleFetchMissingAsset() 84 //public void TestHandleFetchMissingAsset()
85 //{ 85 //{
86 86
87 // byte[] emptyResult = new byte[] { }; 87 // byte[] emptyResult = new byte[] { };
88 // GetAssetStreamHandler handler = new GetAssetStreamHandler(null); 88 // GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
89 89
90 // Assert.AreEqual(new string[] { }, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid."); 90 // Assert.AreEqual(new string[] { }, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid.");
91 //} 91 //}
92 } 92 }
93} 93}