Esempio n. 1
0
        public void TestGiveInventoryItem()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            Scene scene = new SceneHelpers().SetupScene();
            UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
            UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
            InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID);

            scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID);

            InventoryItemBase retrievedItem1
                = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1");

            Assert.That(retrievedItem1, Is.Not.Null);

            // Try giving back the freshly received item
            scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID);

            List<InventoryItemBase> reretrievedItems
                = UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1");

            Assert.That(reretrievedItems.Count, Is.EqualTo(2));
        }