예제 #1
0
    public void Test_PlayerCanEquipWeapon()
    {
        Weapon weapon = ScriptableObject.CreateInstance <Weapon>();
        PlayerInventoryClass inventory = new PlayerInventoryClass();

        inventory.EquipWeapon(weapon);

        Assert.IsNotNull(inventory.GetEquippedWeapon(), "Player didn't equip a weapon!");
    }
예제 #2
0
    public void Test_PlayerReceivesDamageIncreaseFromEquippedWeapon()
    {
        Weapon               weapon    = ScriptableObject.CreateInstance <Weapon>();
        PlayerStatsClass     stats     = new PlayerStatsClass();
        PlayerInventoryClass inventory = new PlayerInventoryClass();

        int damageWithoutWeapon = stats.GetCurrentAttackDamage();

        inventory.EquipWeapon(weapon);

        IPlayer mockPlayer = Substitute.For <IPlayer>();

        mockPlayer.GetAllDamageBonus().Returns(inventory.GetEquippedWeapon().damage);
        stats.SetPlayerAddition(mockPlayer);

        int damageAfterEquip = stats.GetCurrentAttackDamage();

        Assert.IsNotNull(inventory.GetEquippedWeapon(), "Player didn't equip the weapon!");
        Assert.Greater(damageAfterEquip, damageWithoutWeapon, "Player damage did not increase after equipping a weapon!");
    }