From b1f018aa2600281cc379128f17c3c141b478f39d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 12 Dec 2008 20:43:42 +0000 Subject: * Create update folder test * Correct small logic elidation --- .../Tests/Cache/UserProfileCacheServiceTests.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'OpenSim/Framework/Communications/Tests/Cache') diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index 0914bfb..41c8e3c 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs @@ -122,6 +122,38 @@ namespace OpenSim.Framework.Communications.Tests Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null); Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True); } + + /// + /// Test updating a folder + /// + [Test] + public void TestUpdateFolder() + { + 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-000000000060"); + InventoryFolderImpl rootFolder = userInfo.RootFolder; + + userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); + + // 1: Test updates that don't involve moving the folder + string newFolderName1 = "newFolderName1"; + ushort folderType1 = (ushort)AssetType.Texture; + userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID); + + InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id); + Assert.That(newFolderName1, Is.EqualTo(folder1.Name)); + Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type)); + + InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id); + Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name)); + Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type)); + } /// /// Test moving an inventory folder -- cgit v1.1