示例#1
0
        public void InventoryItemExistenceCheck()
        {
            m_Inventory.AddItem(m_ExistantItem);

            Assert.DoesNotThrow(
                () => m_Inventory.CheckItemInInventory(m_ExistantItem),
                "No exception when checking for existence and exists");

            Assert.Throws(
                typeof(Exception),
                () => m_Inventory.CheckItemInInventory(m_NonExistantItem),
                "Exception when checking for existence and doesn't exist");

            Assert.DoesNotThrow(
                () => m_Inventory.CheckItemInInventory(m_NonExistantItem, false),
                "No exception when checking for absence and doesn't exist");

            Assert.Throws(
                typeof(Exception),
                () => m_Inventory.CheckItemInInventory(m_ExistantItem, false),
                "Exception when checking for absence and exists");
        }