From fe471b64245f99a895d661a8952fc3c226ba6bfe Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 4 Jun 2011 02:44:53 +0100 Subject: [PATCH] Extend TestGiveInventoryFolder() to test giving back the freshly received folder --- .../Framework/Scenes/Tests/UserInventoryTests.cs | 8 ++++++++ .../Tests/Common/Helpers/UserInventoryHelpers.cs | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 10c275e040..abca792b8d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -97,6 +97,14 @@ namespace OpenSim.Region.Framework.Tests = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1"); Assert.That(retrievedFolder1, Is.Not.Null); + + // Try giving back the freshly received folder + scene.GiveInventoryFolder(user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero); + + List reretrievedFolders + = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1"); + + Assert.That(reretrievedFolders.Count, Is.EqualTo(2)); } } } \ No newline at end of file diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 875bf4ac2c..1703597549 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs @@ -147,8 +147,7 @@ namespace OpenSim.Tests.Common /// null if no folder matching the path was found public static InventoryFolderBase GetInventoryFolder(IInventoryService inventoryService, UUID userId, string path) { - List folders - = InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path); + List folders = GetInventoryFolders(inventoryService, userId, path); if (folders.Count != 0) return folders[0]; @@ -156,6 +155,18 @@ namespace OpenSim.Tests.Common return null; } + /// + /// Get the inventory folders that match the path name. + /// + /// + /// + /// + /// An empty list if no matching folders were found + public static List GetInventoryFolders(IInventoryService inventoryService, UUID userId, string path) + { + return InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path); + } + /// /// Get the inventory item that matches the path name. If there are multiple items then only the first /// is returned.