From 9f6e567cb13a123ddaac4cc738594dd70c089c74 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 12 Dec 2008 19:37:51 +0000 Subject: [PATCH] * add purge folder test --- .../Cache/UserProfileCacheServiceTests.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index 215fa81498..2196d25607 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs @@ -137,8 +137,7 @@ namespace OpenSim.Framework.Communications.Tests UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); - UUID folderToMoveId = UUID.Parse("00000000-0000-0000-0000-000000000030"); - + UUID folderToMoveId = UUID.Parse("00000000-0000-0000-0000-000000000030"); InventoryFolderImpl rootFolder = userInfo.RootFolder; userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); @@ -158,5 +157,29 @@ namespace OpenSim.Framework.Communications.Tests Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False); } + + /// + /// Test purging an inventory folder + /// + public void TestPurgeFolder() + { + IUserDataPlugin userDataPlugin = new TestUserDataPlugin(); + IInventoryDataPlugin inventoryDataPlugin = new TestInventoryDataPlugin(); + + CommunicationsManager commsManager + = UserProfileTestUtils.SetupServices(userDataPlugin, inventoryDataPlugin); + CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); + + UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); + InventoryFolderImpl rootFolder = userInfo.RootFolder; + + userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); + + // Test purge + userInfo.PurgeFolder(rootFolder.ID); + + Assert.That(rootFolder.RequestListOfFolders(), Is.Empty); + Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Null); + } } }