diff options
author | BlueWall | 2011-03-21 22:06:43 -0400 |
---|---|---|
committer | BlueWall | 2011-03-21 22:06:43 -0400 |
commit | e3c327a305dcf795f372b940f34538a19bf92218 (patch) | |
tree | b034355a12c4d87410809aa19bf6015e611e1e22 /OpenSim/Data/Tests/InventoryTests.cs | |
parent | Merge branch 'master' of /home/opensim/src/OpenSim/Core (diff) | |
parent | Thanks Kevin Cozens for a patch that: (diff) | |
download | opensim-SC-e3c327a305dcf795f372b940f34538a19bf92218.zip opensim-SC-e3c327a305dcf795f372b940f34538a19bf92218.tar.gz opensim-SC-e3c327a305dcf795f372b940f34538a19bf92218.tar.bz2 opensim-SC-e3c327a305dcf795f372b940f34538a19bf92218.tar.xz |
Merge branch 'master' of /home/opensim/src/OpenSim/Core
Diffstat (limited to 'OpenSim/Data/Tests/InventoryTests.cs')
-rw-r--r-- | OpenSim/Data/Tests/InventoryTests.cs | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs index 9c2a2d6..cf3bac1 100644 --- a/OpenSim/Data/Tests/InventoryTests.cs +++ b/OpenSim/Data/Tests/InventoryTests.cs | |||
@@ -25,14 +25,12 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | // #define NUNIT25 | ||
29 | |||
30 | using System; | 28 | using System; |
31 | using log4net.Config; | 29 | using log4net.Config; |
32 | using NUnit.Framework; | 30 | using NUnit.Framework; |
33 | using NUnit.Framework.SyntaxHelpers; | ||
34 | using OpenMetaverse; | 31 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Tests.Common; | ||
36 | using log4net; | 34 | using log4net; |
37 | using System.Reflection; | 35 | using System.Reflection; |
38 | using System.Data.Common; | 36 | using System.Data.Common; |
@@ -49,14 +47,6 @@ using OpenSim.Data.SQLite; | |||
49 | 47 | ||
50 | namespace OpenSim.Data.Tests | 48 | namespace OpenSim.Data.Tests |
51 | { | 49 | { |
52 | #if NUNIT25 | ||
53 | |||
54 | [TestFixture(typeof(SqliteConnection), typeof(SQLiteInventoryStore), Description = "Inventory store tests (SQLite)")] | ||
55 | [TestFixture(typeof(MySqlConnection), typeof(MySQLInventoryData), Description = "Inventory store tests (MySQL)")] | ||
56 | [TestFixture(typeof(SqlConnection), typeof(MSSQLInventoryData), Description = "Inventory store tests (MS SQL Server)")] | ||
57 | |||
58 | #else | ||
59 | |||
60 | [TestFixture(Description = "Inventory store tests (SQLite)")] | 50 | [TestFixture(Description = "Inventory store tests (SQLite)")] |
61 | public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore> | 51 | public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore> |
62 | { | 52 | { |
@@ -71,7 +61,6 @@ namespace OpenSim.Data.Tests | |||
71 | public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData> | 61 | public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData> |
72 | { | 62 | { |
73 | } | 63 | } |
74 | #endif | ||
75 | 64 | ||
76 | public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore> | 65 | public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore> |
77 | where TConn : DbConnection, new() | 66 | where TConn : DbConnection, new() |
@@ -125,6 +114,8 @@ namespace OpenSim.Data.Tests | |||
125 | [Test] | 114 | [Test] |
126 | public void T001_LoadEmpty() | 115 | public void T001_LoadEmpty() |
127 | { | 116 | { |
117 | TestHelper.InMethod(); | ||
118 | |||
128 | Assert.That(db.getInventoryFolder(zero), Is.Null); | 119 | Assert.That(db.getInventoryFolder(zero), Is.Null); |
129 | Assert.That(db.getInventoryFolder(folder1), Is.Null); | 120 | Assert.That(db.getInventoryFolder(folder1), Is.Null); |
130 | Assert.That(db.getInventoryFolder(folder2), Is.Null); | 121 | Assert.That(db.getInventoryFolder(folder2), Is.Null); |
@@ -143,6 +134,8 @@ namespace OpenSim.Data.Tests | |||
143 | [Test] | 134 | [Test] |
144 | public void T010_FolderNonParent() | 135 | public void T010_FolderNonParent() |
145 | { | 136 | { |
137 | TestHelper.InMethod(); | ||
138 | |||
146 | InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2); | 139 | InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2); |
147 | // the folder will go in | 140 | // the folder will go in |
148 | db.addInventoryFolder(f1); | 141 | db.addInventoryFolder(f1); |
@@ -153,6 +146,8 @@ namespace OpenSim.Data.Tests | |||
153 | [Test] | 146 | [Test] |
154 | public void T011_FolderCreate() | 147 | public void T011_FolderCreate() |
155 | { | 148 | { |
149 | TestHelper.InMethod(); | ||
150 | |||
156 | InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1); | 151 | InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1); |
157 | // TODO: this is probably wrong behavior, but is what we have | 152 | // TODO: this is probably wrong behavior, but is what we have |
158 | // db.updateInventoryFolder(f1); | 153 | // db.updateInventoryFolder(f1); |
@@ -165,7 +160,7 @@ namespace OpenSim.Data.Tests | |||
165 | db.addInventoryFolder(f1); | 160 | db.addInventoryFolder(f1); |
166 | InventoryFolderBase f1a = db.getUserRootFolder(owner1); | 161 | InventoryFolderBase f1a = db.getUserRootFolder(owner1); |
167 | Assert.That(folder1, Is.EqualTo(f1a.ID), "Assert.That(folder1, Is.EqualTo(f1a.ID))"); | 162 | Assert.That(folder1, Is.EqualTo(f1a.ID), "Assert.That(folder1, Is.EqualTo(f1a.ID))"); |
168 | Assert.That(name1, Text.Matches(f1a.Name), "Assert.That(name1, Text.Matches(f1a.Name))"); | 163 | Assert.That(name1, Is.StringMatching(f1a.Name), "Assert.That(name1, Text.Matches(f1a.Name))"); |
169 | } | 164 | } |
170 | 165 | ||
171 | // we now have the following tree | 166 | // we now have the following tree |
@@ -176,6 +171,8 @@ namespace OpenSim.Data.Tests | |||
176 | [Test] | 171 | [Test] |
177 | public void T012_FolderList() | 172 | public void T012_FolderList() |
178 | { | 173 | { |
174 | TestHelper.InMethod(); | ||
175 | |||
179 | InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); | 176 | InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); |
180 | db.addInventoryFolder(f2); | 177 | db.addInventoryFolder(f2); |
181 | 178 | ||
@@ -190,6 +187,8 @@ namespace OpenSim.Data.Tests | |||
190 | [Test] | 187 | [Test] |
191 | public void T013_FolderHierarchy() | 188 | public void T013_FolderHierarchy() |
192 | { | 189 | { |
190 | TestHelper.InMethod(); | ||
191 | |||
193 | int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) | 192 | int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) |
194 | Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); | 193 | Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); |
195 | n = db.getFolderHierarchy(folder1).Count; | 194 | n = db.getFolderHierarchy(folder1).Count; |
@@ -203,6 +202,8 @@ namespace OpenSim.Data.Tests | |||
203 | [Test] | 202 | [Test] |
204 | public void T014_MoveFolder() | 203 | public void T014_MoveFolder() |
205 | { | 204 | { |
205 | TestHelper.InMethod(); | ||
206 | |||
206 | InventoryFolderBase f2 = db.getInventoryFolder(folder2); | 207 | InventoryFolderBase f2 = db.getInventoryFolder(folder2); |
207 | f2.ParentID = folder3; | 208 | f2.ParentID = folder3; |
208 | db.moveInventoryFolder(f2); | 209 | db.moveInventoryFolder(f2); |
@@ -217,6 +218,8 @@ namespace OpenSim.Data.Tests | |||
217 | [Test] | 218 | [Test] |
218 | public void T015_FolderHierarchy() | 219 | public void T015_FolderHierarchy() |
219 | { | 220 | { |
221 | TestHelper.InMethod(); | ||
222 | |||
220 | Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); | 223 | Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); |
221 | Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); | 224 | Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); |
222 | Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))"); | 225 | Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))"); |
@@ -228,6 +231,8 @@ namespace OpenSim.Data.Tests | |||
228 | [Test] | 231 | [Test] |
229 | public void T100_NoItems() | 232 | public void T100_NoItems() |
230 | { | 233 | { |
234 | TestHelper.InMethod(); | ||
235 | |||
231 | Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); | 236 | Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); |
232 | Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))"); | 237 | Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))"); |
233 | Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0))"); | 238 | Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0))"); |
@@ -240,6 +245,8 @@ namespace OpenSim.Data.Tests | |||
240 | [Test] | 245 | [Test] |
241 | public void T101_CreatItems() | 246 | public void T101_CreatItems() |
242 | { | 247 | { |
248 | TestHelper.InMethod(); | ||
249 | |||
243 | db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1)); | 250 | db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1)); |
244 | db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2)); | 251 | db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2)); |
245 | db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3)); | 252 | db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3)); |
@@ -249,6 +256,8 @@ namespace OpenSim.Data.Tests | |||
249 | [Test] | 256 | [Test] |
250 | public void T102_CompareItems() | 257 | public void T102_CompareItems() |
251 | { | 258 | { |
259 | TestHelper.InMethod(); | ||
260 | |||
252 | InventoryItemBase i1 = db.getInventoryItem(item1); | 261 | InventoryItemBase i1 = db.getInventoryItem(item1); |
253 | InventoryItemBase i2 = db.getInventoryItem(item2); | 262 | InventoryItemBase i2 = db.getInventoryItem(item2); |
254 | InventoryItemBase i3 = db.getInventoryItem(item3); | 263 | InventoryItemBase i3 = db.getInventoryItem(item3); |
@@ -266,6 +275,8 @@ namespace OpenSim.Data.Tests | |||
266 | [Test] | 275 | [Test] |
267 | public void T103_UpdateItem() | 276 | public void T103_UpdateItem() |
268 | { | 277 | { |
278 | TestHelper.InMethod(); | ||
279 | |||
269 | // TODO: probably shouldn't have the ability to have an | 280 | // TODO: probably shouldn't have the ability to have an |
270 | // owner of an item in a folder not owned by the user | 281 | // owner of an item in a folder not owned by the user |
271 | 282 | ||
@@ -284,6 +295,8 @@ namespace OpenSim.Data.Tests | |||
284 | [Test] | 295 | [Test] |
285 | public void T104_RandomUpdateItem() | 296 | public void T104_RandomUpdateItem() |
286 | { | 297 | { |
298 | TestHelper.InMethod(); | ||
299 | |||
287 | PropertyScrambler<InventoryFolderBase> folderScrambler = | 300 | PropertyScrambler<InventoryFolderBase> folderScrambler = |
288 | new PropertyScrambler<InventoryFolderBase>() | 301 | new PropertyScrambler<InventoryFolderBase>() |
289 | .DontScramble(x => x.Owner) | 302 | .DontScramble(x => x.Owner) |
@@ -341,6 +354,8 @@ namespace OpenSim.Data.Tests | |||
341 | [Test] | 354 | [Test] |
342 | public void T999_StillNull() | 355 | public void T999_StillNull() |
343 | { | 356 | { |
357 | TestHelper.InMethod(); | ||
358 | |||
344 | // After all tests are run, these should still return no results | 359 | // After all tests are run, these should still return no results |
345 | Assert.That(db.getInventoryFolder(zero), Is.Null); | 360 | Assert.That(db.getInventoryFolder(zero), Is.Null); |
346 | Assert.That(db.getInventoryItem(zero), Is.Null); | 361 | Assert.That(db.getInventoryItem(zero), Is.Null); |