public void TestCreateInventoryFolders() { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); // For this test both folders will have the same name which is legal in SL user inventories. string foldersName = "f1"; Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName, false); List <InventoryFolderBase> oneFolder = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); Assert.That(oneFolder.Count, Is.EqualTo(1)); InventoryFolderBase firstRetrievedFolder = oneFolder[0]; Assert.That(firstRetrievedFolder.Name, Is.EqualTo(foldersName)); UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName, false); List <InventoryFolderBase> twoFolders = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); Assert.That(twoFolders.Count, Is.EqualTo(2)); Assert.That(twoFolders[0].Name, Is.EqualTo(foldersName)); Assert.That(twoFolders[1].Name, Is.EqualTo(foldersName)); Assert.That(twoFolders[0].ID, Is.Not.EqualTo(twoFolders[1].ID)); }
public void TestGiveInventoryFolder() { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); InventoryFolderBase folder1 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false); scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); InventoryFolderBase retrievedFolder1 = 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)); }