aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/BasicInventoryTest.cs
diff options
context:
space:
mode:
authorKunnis2009-08-15 10:54:48 -0500
committerTeravus Ovares (Dan Olivares)2009-08-16 14:17:29 -0400
commitd2e5380cb2325ad42917c528c52a8ad42ec0176f (patch)
tree614ef74c8083db2afb1384b2acba0108e493b6c7 /OpenSim/Data/Tests/BasicInventoryTest.cs
parent* Modified SQLite/SQLiteInventoryStore.cs to not throw if the inventory row d... (diff)
downloadopensim-SC_OLD-d2e5380cb2325ad42917c528c52a8ad42ec0176f.zip
opensim-SC_OLD-d2e5380cb2325ad42917c528c52a8ad42ec0176f.tar.gz
opensim-SC_OLD-d2e5380cb2325ad42917c528c52a8ad42ec0176f.tar.bz2
opensim-SC_OLD-d2e5380cb2325ad42917c528c52a8ad42ec0176f.tar.xz
* Fixed MySQL/MySQLAssetData.cs to properly do updates * Removed an extra parameter from MySQL/MySQLInventoryData.cs * Fixed a bug in SQLite/SQLiteAssetData.cs that was causing a NRE when updating an asset. * Improved the BasicAssetTest.cs to do full create/update/get testing * Improved the BasicInventoryTest.cs to do full create/update/get of both a folder and an item * Moved the null ref tests to the start of the PropertyCompareConstraint.cs, so that it doesn't throw when passing in a null item
Diffstat (limited to 'OpenSim/Data/Tests/BasicInventoryTest.cs')
-rw-r--r--OpenSim/Data/Tests/BasicInventoryTest.cs56
1 files changed, 49 insertions, 7 deletions
diff --git a/OpenSim/Data/Tests/BasicInventoryTest.cs b/OpenSim/Data/Tests/BasicInventoryTest.cs
index 967c6e7..21552c8 100644
--- a/OpenSim/Data/Tests/BasicInventoryTest.cs
+++ b/OpenSim/Data/Tests/BasicInventoryTest.cs
@@ -258,17 +258,59 @@ namespace OpenSim.Data.Tests
258 [Test] 258 [Test]
259 public void T104_RandomUpdateItem() 259 public void T104_RandomUpdateItem()
260 { 260 {
261 InventoryItemBase expected = db.getInventoryItem(item1); 261 UUID owner = UUID.Random();
262 UUID folder = UUID.Random();
263 UUID rootId = UUID.Random();
264 UUID rootAsset = UUID.Random();
265 InventoryFolderBase f1 = NewFolder(folder, zero, owner, name1);
266 ScrambleForTesting.Scramble(f1);
267 f1.Owner = owner;
268 f1.ParentID = zero;
269 f1.ID = folder;
270
271 // succeed with true
272 db.addInventoryFolder(f1);
273 InventoryFolderBase f1a = db.getUserRootFolder(owner);
274 Assert.That(f1a, Constraints.PropertyCompareConstraint(f1));
275
276 ScrambleForTesting.Scramble(f1a);
277 f1a.Owner = owner;
278 f1a.ParentID = zero;
279 f1a.ID = folder;
280 db.updateInventoryFolder(f1a);
281
282 InventoryFolderBase f1b = db.getUserRootFolder(owner);
283 Assert.That(f1b, Constraints.PropertyCompareConstraint(f1a));
284
285 //Now we have a valid folder to insert into, we can insert the item.
286 InventoryItemBase root = NewItem(rootId, folder, owner, iname1, rootAsset);
287 ScrambleForTesting.Scramble(root);
288 root.ID = rootId;
289 root.AssetID = rootAsset;
290 root.Owner = owner;
291 root.Folder = folder;
292 db.addInventoryItem(root);
293
294 InventoryItemBase expected = db.getInventoryItem(rootId);
295 Assert.That(expected, Constraints.PropertyCompareConstraint(root)
296 .IgnoreProperty(x => x.InvType)
297 .IgnoreProperty(x => x.CreatorIdAsUuid)
298 .IgnoreProperty(x => x.Description)
299 .IgnoreProperty(x => x.CreatorId));
300
262 ScrambleForTesting.Scramble(expected); 301 ScrambleForTesting.Scramble(expected);
263 expected.ID = item1; 302 expected.ID = rootId;
303 expected.AssetID = rootAsset;
304 expected.Owner = owner;
305 expected.Folder = folder;
264 db.updateInventoryItem(expected); 306 db.updateInventoryItem(expected);
265 307
266 InventoryItemBase actual = db.getInventoryItem(item1); 308 InventoryItemBase actual = db.getInventoryItem(rootId);
267 Assert.That(actual, Constraints.PropertyCompareConstraint(expected) 309 Assert.That(actual, Constraints.PropertyCompareConstraint(expected)
268 .IgnoreProperty(x=>x.InvType) 310 .IgnoreProperty(x => x.InvType)
269 .IgnoreProperty(x=>x.CreatorIdAsUuid) 311 .IgnoreProperty(x => x.CreatorIdAsUuid)
270 .IgnoreProperty(x=>x.Description) 312 .IgnoreProperty(x => x.Description)
271 .IgnoreProperty(x=>x.CreatorId)); 313 .IgnoreProperty(x => x.CreatorId));
272 } 314 }
273 315
274 [Test] 316 [Test]