コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public void PrimaryAttribute_Raises_Changed_On_Decreasing_Float()
 {
     _mockAttr.Decrease(5f);
     Assert.IsTrue(_changed);
 }