Extend TestGiveInventoryFolder() to test giving back the freshly received folder

bulletsim
Justin Clark-Casey (justincc) 2011-06-04 02:44:53 +01:00
parent 12b1cbf8bf
commit fe471b6424
2 changed files with 21 additions and 2 deletions

View File

@ -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<InventoryFolderBase> reretrievedFolders
= UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1");
Assert.That(reretrievedFolders.Count, Is.EqualTo(2));
}
}
}

View File

@ -147,8 +147,7 @@ namespace OpenSim.Tests.Common
/// <returns>null if no folder matching the path was found</returns>
public static InventoryFolderBase GetInventoryFolder(IInventoryService inventoryService, UUID userId, string path)
{
List<InventoryFolderBase> folders
= InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path);
List<InventoryFolderBase> folders = GetInventoryFolders(inventoryService, userId, path);
if (folders.Count != 0)
return folders[0];
@ -156,6 +155,18 @@ namespace OpenSim.Tests.Common
return null;
}
/// <summary>
/// Get the inventory folders that match the path name.
/// </summary>
/// <param name="inventoryService"></param>
/// <param name="userId"></param>
/// <param name="path"></param>
/// <returns>An empty list if no matching folders were found</returns>
public static List<InventoryFolderBase> GetInventoryFolders(IInventoryService inventoryService, UUID userId, string path)
{
return InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path);
}
/// <summary>
/// Get the inventory item that matches the path name. If there are multiple items then only the first
/// is returned.