public void TC15EquipPotionTest() { UserData userData = new UserData(); userData.userName = "******"; GameObject inventoryGameObject = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/InventoryCanvas")); InventoryViewModel inventoryViewModel = inventoryGameObject.transform.Find("InventoryUI").Find("Inbag ScrollView").Find("Viewport").Find("In-bagContent").GetComponent <InventoryViewModel>(); inventoryViewModel.setUserData(userData); // create only one item to be stored in the inventory Item inBagWeapon = new Item(); inBagWeapon.name = "Healing Potion"; inBagWeapon.studentUsername = "******"; inBagWeapon.quantity = 1; inBagWeapon.property = Item.HEALINGPOTION; // set one item which is "Healing Potion" to inventory items Dictionary <string, Item> inBagList = new Dictionary <string, Item>(); inBagList.Add(inBagWeapon.studentUsername + inBagWeapon.name, inBagWeapon); inventoryViewModel.setInBagList(inBagList); // generate an item to be equipped which is "Bronze Dagger" Item equippedWeapon = new Item(); equippedWeapon.name = "Bronze Dagger"; equippedWeapon.studentUsername = "******"; equippedWeapon.quantity = 1; equippedWeapon.property = Item.WEAPON; EquippedItems equippedItems = new EquippedItems(); equippedItems.weapon = equippedWeapon; inventoryViewModel.setEquippedItems(equippedItems); // stimulate click on the first item as there are only one item in the inventory and check if it is fails to be equipped inventoryViewModel.onInBagItemClick(inventoryViewModel.getInstantiatedUI()[0]); // check if "Healing Potion" is not being equipped as a weapon Assert.AreNotEqual("Healing Potion", inventoryViewModel.equippedWeapon.GetComponent <Text>().text);; // check if "Healing Potion" is still in the inventory Assert.AreEqual("Healing Potion", inventoryViewModel.getInstantiatedUI()[0].transform.GetChild(0).GetComponent <Text>().text); }