diff options
Diffstat (limited to 'OpenSim/Data/Tests/BasicInventoryTest.cs')
-rw-r--r-- | OpenSim/Data/Tests/BasicInventoryTest.cs | 86 |
1 files changed, 67 insertions, 19 deletions
diff --git a/OpenSim/Data/Tests/BasicInventoryTest.cs b/OpenSim/Data/Tests/BasicInventoryTest.cs index e13ed89..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(); |
@@ -115,16 +108,6 @@ namespace OpenSim.Data.Tests | |||
115 | Assert.That(db.getUserRootFolder(owner1), Is.Null); | 108 | Assert.That(db.getUserRootFolder(owner1), Is.Null); |
116 | } | 109 | } |
117 | 110 | ||
118 | [Test] | ||
119 | public void T999_StillNull() | ||
120 | { | ||
121 | // After all tests are run, these should still return no results | ||
122 | Assert.That(db.getInventoryFolder(zero), Is.Null); | ||
123 | Assert.That(db.getInventoryItem(zero), Is.Null); | ||
124 | Assert.That(db.getUserRootFolder(zero), Is.Null); | ||
125 | Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); | ||
126 | } | ||
127 | |||
128 | // 01x - folder tests | 111 | // 01x - folder tests |
129 | [Test] | 112 | [Test] |
130 | public void T010_FolderNonParent() | 113 | public void T010_FolderNonParent() |
@@ -248,7 +231,7 @@ namespace OpenSim.Data.Tests | |||
248 | } | 231 | } |
249 | 232 | ||
250 | [Test] | 233 | [Test] |
251 | public void T103UpdateItem() | 234 | public void T103_UpdateItem() |
252 | { | 235 | { |
253 | // TODO: probably shouldn't have the ability to have an | 236 | // TODO: probably shouldn't have the ability to have an |
254 | // owner of an item in a folder not owned by the user | 237 | // owner of an item in a folder not owned by the user |
@@ -265,6 +248,71 @@ namespace OpenSim.Data.Tests | |||
265 | Assert.That(i1.Owner, Is.EqualTo(owner2), "Assert.That(i1.Owner, Is.EqualTo(owner2))"); | 248 | Assert.That(i1.Owner, Is.EqualTo(owner2), "Assert.That(i1.Owner, Is.EqualTo(owner2))"); |
266 | } | 249 | } |
267 | 250 | ||
251 | [Test] | ||
252 | public void T104_RandomUpdateItem() | ||
253 | { | ||
254 | PropertyScrambler<InventoryFolderBase> folderScrambler = | ||
255 | new PropertyScrambler<InventoryFolderBase>() | ||
256 | .DontScramble(x => x.Owner) | ||
257 | .DontScramble(x => x.ParentID) | ||
258 | .DontScramble(x => x.ID); | ||
259 | UUID owner = UUID.Random(); | ||
260 | UUID folder = UUID.Random(); | ||
261 | UUID rootId = UUID.Random(); | ||
262 | UUID rootAsset = UUID.Random(); | ||
263 | InventoryFolderBase f1 = NewFolder(folder, zero, owner, name1); | ||
264 | folderScrambler.Scramble(f1); | ||
265 | |||
266 | db.addInventoryFolder(f1); | ||
267 | InventoryFolderBase f1a = db.getUserRootFolder(owner); | ||
268 | Assert.That(f1a, Constraints.PropertyCompareConstraint(f1)); | ||
269 | |||
270 | folderScrambler.Scramble(f1a); | ||
271 | |||
272 | db.updateInventoryFolder(f1a); | ||
273 | |||
274 | InventoryFolderBase f1b = db.getUserRootFolder(owner); | ||
275 | Assert.That(f1b, Constraints.PropertyCompareConstraint(f1a)); | ||
276 | |||
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); | ||
284 | InventoryItemBase root = NewItem(rootId, folder, owner, iname1, rootAsset); | ||
285 | inventoryScrambler.Scramble(root); | ||
286 | db.addInventoryItem(root); | ||
287 | |||
288 | InventoryItemBase expected = db.getInventoryItem(rootId); | ||
289 | Assert.That(expected, Constraints.PropertyCompareConstraint(root) | ||
290 | .IgnoreProperty(x => x.InvType) | ||
291 | .IgnoreProperty(x => x.CreatorIdAsUuid) | ||
292 | .IgnoreProperty(x => x.Description) | ||
293 | .IgnoreProperty(x => x.CreatorId)); | ||
294 | |||
295 | inventoryScrambler.Scramble(expected); | ||
296 | db.updateInventoryItem(expected); | ||
297 | |||
298 | InventoryItemBase actual = db.getInventoryItem(rootId); | ||
299 | Assert.That(actual, Constraints.PropertyCompareConstraint(expected) | ||
300 | .IgnoreProperty(x => x.InvType) | ||
301 | .IgnoreProperty(x => x.CreatorIdAsUuid) | ||
302 | .IgnoreProperty(x => x.Description) | ||
303 | .IgnoreProperty(x => x.CreatorId)); | ||
304 | } | ||
305 | |||
306 | [Test] | ||
307 | public void T999_StillNull() | ||
308 | { | ||
309 | // After all tests are run, these should still return no results | ||
310 | Assert.That(db.getInventoryFolder(zero), Is.Null); | ||
311 | Assert.That(db.getInventoryItem(zero), Is.Null); | ||
312 | Assert.That(db.getUserRootFolder(zero), Is.Null); | ||
313 | Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); | ||
314 | } | ||
315 | |||
268 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) | 316 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) |
269 | { | 317 | { |
270 | InventoryItemBase i = new InventoryItemBase(); | 318 | InventoryItemBase i = new InventoryItemBase(); |