public void PrimaryAttribute_Correctly_Increases_With_Float_When_Type_Is_Float(float inc) { _mockAttr = Substitute.ForPartsOf <PrimaryAttribute>(AttributeType.Float, _dfValue); _mockAttr.Increase(inc); Assert.AreEqual(inc + _dfValue, _mockAttr.CurrentValue); }
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_Wont_Clamp_When_Increasing_Without_Max_Val() { _mockAttr = Substitute.ForPartsOf <PrimaryAttribute>(AttributeType.Float, _dfValue); _mockAttr.Increase(300f); Assert.AreEqual(300f + _dfValue, _mockAttr.CurrentValue); }
public void PrimaryAttribute_Raises_Changed_On_Increasing_Float() { _mockAttr.Increase(5f); Assert.IsTrue(_changed); }