diff options
author | Sean Dague | 2008-09-11 18:49:37 +0000 |
---|---|---|
committer | Sean Dague | 2008-09-11 18:49:37 +0000 |
commit | 45df1aaa64bb64785fb8b926ddd45042623c890c (patch) | |
tree | 2fffa8d99dadef509078641e7038e0cd0937a462 /OpenSim/Data/SQLite | |
parent | added simple add / exists folder check (diff) | |
download | opensim-SC_OLD-45df1aaa64bb64785fb8b926ddd45042623c890c.zip opensim-SC_OLD-45df1aaa64bb64785fb8b926ddd45042623c890c.tar.gz opensim-SC_OLD-45df1aaa64bb64785fb8b926ddd45042623c890c.tar.bz2 opensim-SC_OLD-45df1aaa64bb64785fb8b926ddd45042623c890c.tar.xz |
add some folder create and list tests
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r-- | OpenSim/Data/SQLite/Tests/SQLiteInventoryTest.cs | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/OpenSim/Data/SQLite/Tests/SQLiteInventoryTest.cs b/OpenSim/Data/SQLite/Tests/SQLiteInventoryTest.cs index 9398971..2865f44 100644 --- a/OpenSim/Data/SQLite/Tests/SQLiteInventoryTest.cs +++ b/OpenSim/Data/SQLite/Tests/SQLiteInventoryTest.cs | |||
@@ -67,6 +67,8 @@ namespace OpenSim.Data.SQLite.Tests | |||
67 | owner2 = UUID.Random(); | 67 | owner2 = UUID.Random(); |
68 | owner3 = UUID.Random(); | 68 | owner3 = UUID.Random(); |
69 | name1 = "Root Folder for " + owner1.ToString(); | 69 | name1 = "Root Folder for " + owner1.ToString(); |
70 | name2 = "First Level folder"; | ||
71 | name3 = "First Level folder 2"; | ||
70 | } | 72 | } |
71 | 73 | ||
72 | [TestFixtureTearDown] | 74 | [TestFixtureTearDown] |
@@ -84,7 +86,17 @@ namespace OpenSim.Data.SQLite.Tests | |||
84 | 86 | ||
85 | // 01x - folder tests | 87 | // 01x - folder tests |
86 | [Test] | 88 | [Test] |
87 | public void T010_FolderCreate() | 89 | public void T010_FolderNonParent() |
90 | { | ||
91 | InventoryFolderBase f1 = NewFolder(uuid2, uuid1, owner1, name2); | ||
92 | // the folder will go in | ||
93 | db.addInventoryFolder(f1); | ||
94 | InventoryFolderBase f1a = db.getUserRootFolder(owner1); | ||
95 | Assert.That(f1a, Is.Null); | ||
96 | } | ||
97 | |||
98 | [Test] | ||
99 | public void T011_FolderCreate() | ||
88 | { | 100 | { |
89 | InventoryFolderBase f1 = NewFolder(uuid1, zero, owner1, name1); | 101 | InventoryFolderBase f1 = NewFolder(uuid1, zero, owner1, name1); |
90 | // TODO: this is probably wrong behavior, but is what we have | 102 | // TODO: this is probably wrong behavior, but is what we have |
@@ -101,6 +113,33 @@ namespace OpenSim.Data.SQLite.Tests | |||
101 | Assert.That(name1, Text.Matches(f1a.Name)); | 113 | Assert.That(name1, Text.Matches(f1a.Name)); |
102 | } | 114 | } |
103 | 115 | ||
116 | // we now have the following tree | ||
117 | // uuid1 | ||
118 | // +--- uuid2 | ||
119 | // +--- uuid3 | ||
120 | |||
121 | [Test] | ||
122 | public void T012_FolderList() | ||
123 | { | ||
124 | InventoryFolderBase f2 = NewFolder(uuid3, uuid1, owner1, name3); | ||
125 | db.addInventoryFolder(f2); | ||
126 | |||
127 | List<InventoryFolderBase> flist = db.getInventoryFolders(zero); | ||
128 | Assert.That(flist.Count, Is.EqualTo(1)); | ||
129 | |||
130 | flist = db.getInventoryFolders(uuid1); | ||
131 | Assert.That(flist.Count, Is.EqualTo(2)); | ||
132 | |||
133 | flist = db.getInventoryFolders(uuid2); | ||
134 | Assert.That(flist.Count, Is.EqualTo(0)); | ||
135 | |||
136 | flist = db.getInventoryFolders(uuid3); | ||
137 | Assert.That(flist.Count, Is.EqualTo(0)); | ||
138 | |||
139 | flist = db.getInventoryFolders(UUID.Random()); | ||
140 | Assert.That(flist.Count, Is.EqualTo(0)); | ||
141 | } | ||
142 | |||
104 | private InventoryFolderBase NewFolder(UUID id, UUID parent, UUID owner, string name) | 143 | private InventoryFolderBase NewFolder(UUID id, UUID parent, UUID owner, string name) |
105 | { | 144 | { |
106 | InventoryFolderBase f = new InventoryFolderBase(); | 145 | InventoryFolderBase f = new InventoryFolderBase(); |