aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/BasicInventoryTest.cs
diff options
context:
space:
mode:
authorKunnis2009-08-16 03:35:31 -0500
committerTeravus Ovares (Dan Olivares)2009-08-16 14:34:16 -0400
commitdd78c250aed0924d06e28a826c2ad565ca232045 (patch)
tree331487699d7d2fba8d00cd2a8e57b85e8f77e794 /OpenSim/Data/Tests/BasicInventoryTest.cs
parent* More improvements to BasicAssetTest.cs (diff)
downloadopensim-SC_OLD-dd78c250aed0924d06e28a826c2ad565ca232045.zip
opensim-SC_OLD-dd78c250aed0924d06e28a826c2ad565ca232045.tar.gz
opensim-SC_OLD-dd78c250aed0924d06e28a826c2ad565ca232045.tar.bz2
opensim-SC_OLD-dd78c250aed0924d06e28a826c2ad565ca232045.tar.xz
* Added Expression based ignores to the PropertyScrambler, which makes a lot of the tests clearer because I'm not constantly resetting properties.
Diffstat (limited to 'OpenSim/Data/Tests/BasicInventoryTest.cs')
-rw-r--r--OpenSim/Data/Tests/BasicInventoryTest.cs44
1 files changed, 17 insertions, 27 deletions
diff --git a/OpenSim/Data/Tests/BasicInventoryTest.cs b/OpenSim/Data/Tests/BasicInventoryTest.cs
index 21552c8..900186b 100644
--- a/OpenSim/Data/Tests/BasicInventoryTest.cs
+++ b/OpenSim/Data/Tests/BasicInventoryTest.cs
@@ -66,14 +66,7 @@ namespace OpenSim.Data.Tests
66 66
67 public void SuperInit() 67 public void SuperInit()
68 { 68 {
69 try 69 OpenSim.Tests.Common.TestLogging.LogToConsole();
70 {
71 XmlConfigurator.Configure();
72 }
73 catch (Exception)
74 {
75 // I don't care, just leave log4net off
76 }
77 70
78 folder1 = UUID.Random(); 71 folder1 = UUID.Random();
79 folder2 = UUID.Random(); 72 folder2 = UUID.Random();
@@ -258,37 +251,38 @@ namespace OpenSim.Data.Tests
258 [Test] 251 [Test]
259 public void T104_RandomUpdateItem() 252 public void T104_RandomUpdateItem()
260 { 253 {
254 PropertyScrambler<InventoryFolderBase> folderScrambler =
255 new PropertyScrambler<InventoryFolderBase>()
256 .DontScramble(x => x.Owner)
257 .DontScramble(x => x.ParentID)
258 .DontScramble(x => x.ID);
261 UUID owner = UUID.Random(); 259 UUID owner = UUID.Random();
262 UUID folder = UUID.Random(); 260 UUID folder = UUID.Random();
263 UUID rootId = UUID.Random(); 261 UUID rootId = UUID.Random();
264 UUID rootAsset = UUID.Random(); 262 UUID rootAsset = UUID.Random();
265 InventoryFolderBase f1 = NewFolder(folder, zero, owner, name1); 263 InventoryFolderBase f1 = NewFolder(folder, zero, owner, name1);
266 ScrambleForTesting.Scramble(f1); 264 folderScrambler.Scramble(f1);
267 f1.Owner = owner;
268 f1.ParentID = zero;
269 f1.ID = folder;
270 265
271 // succeed with true
272 db.addInventoryFolder(f1); 266 db.addInventoryFolder(f1);
273 InventoryFolderBase f1a = db.getUserRootFolder(owner); 267 InventoryFolderBase f1a = db.getUserRootFolder(owner);
274 Assert.That(f1a, Constraints.PropertyCompareConstraint(f1)); 268 Assert.That(f1a, Constraints.PropertyCompareConstraint(f1));
275 269
276 ScrambleForTesting.Scramble(f1a); 270 folderScrambler.Scramble(f1a);
277 f1a.Owner = owner; 271
278 f1a.ParentID = zero;
279 f1a.ID = folder;
280 db.updateInventoryFolder(f1a); 272 db.updateInventoryFolder(f1a);
281 273
282 InventoryFolderBase f1b = db.getUserRootFolder(owner); 274 InventoryFolderBase f1b = db.getUserRootFolder(owner);
283 Assert.That(f1b, Constraints.PropertyCompareConstraint(f1a)); 275 Assert.That(f1b, Constraints.PropertyCompareConstraint(f1a));
284 276
285 //Now we have a valid folder to insert into, we can insert the item. 277 //Now we have a valid folder to insert into, we can insert the item.
278 PropertyScrambler<InventoryItemBase> inventoryScrambler =
279 new PropertyScrambler<InventoryItemBase>()
280 .DontScramble(x => x.ID)
281 .DontScramble(x => x.AssetID)
282 .DontScramble(x => x.Owner)
283 .DontScramble(x => x.Folder);
286 InventoryItemBase root = NewItem(rootId, folder, owner, iname1, rootAsset); 284 InventoryItemBase root = NewItem(rootId, folder, owner, iname1, rootAsset);
287 ScrambleForTesting.Scramble(root); 285 inventoryScrambler.Scramble(root);
288 root.ID = rootId;
289 root.AssetID = rootAsset;
290 root.Owner = owner;
291 root.Folder = folder;
292 db.addInventoryItem(root); 286 db.addInventoryItem(root);
293 287
294 InventoryItemBase expected = db.getInventoryItem(rootId); 288 InventoryItemBase expected = db.getInventoryItem(rootId);
@@ -298,11 +292,7 @@ namespace OpenSim.Data.Tests
298 .IgnoreProperty(x => x.Description) 292 .IgnoreProperty(x => x.Description)
299 .IgnoreProperty(x => x.CreatorId)); 293 .IgnoreProperty(x => x.CreatorId));
300 294
301 ScrambleForTesting.Scramble(expected); 295 inventoryScrambler.Scramble(expected);
302 expected.ID = rootId;
303 expected.AssetID = rootAsset;
304 expected.Owner = owner;
305 expected.Folder = folder;
306 db.updateInventoryItem(expected); 296 db.updateInventoryItem(expected);
307 297
308 InventoryItemBase actual = db.getInventoryItem(rootId); 298 InventoryItemBase actual = db.getInventoryItem(rootId);