public void PrimaryAttribute_Correctly_Decreases_With_Float_When_Type_Is_Integer(int startingVal, float dec, int expected) { _mockAttr = Substitute.ForPartsOf <PrimaryAttribute>(AttributeType.Integer, _dfValue); _mockAttr.Increase(startingVal - _dfValue); _mockAttr.Decrease(dec); Assert.AreEqual((float)expected, _mockAttr.CurrentValue); }
public void PrimaryAttribute_Correctly_Decreases_With_Float_When_Type_Is_Float(float startingVal, float dec, float expected) { _mockAttr = Substitute.ForPartsOf <PrimaryAttribute>(AttributeType.Float, _dfValue); _mockAttr.Increase(startingVal - _dfValue); _mockAttr.Decrease(dec); // Need to check range instead of value since there's floating point imprecision Assert.IsTrue(InRange(_mockAttr.CurrentValue, expected)); }
public void PrimaryAttribute_Raises_Changed_On_Decreasing_Float() { _mockAttr.Decrease(5f); Assert.IsTrue(_changed); }