public void SetByIdChangeValue() { var modCol = new StatModifierCollection(OperatorType.Add); modCol.Set("asdf", 22); modCol.Set("asdf", 11.5f); var result = modCol.Get("asdf"); Assert.AreEqual(11.5f, result.value); }
public void ModifyValueDivide() { var modCol = new StatModifierCollection(OperatorType.Divide); modCol.Set("a", 2); modCol.Set("b", 4); var result = modCol.ModifyValue(10); Assert.AreEqual(10f / 2f / 4f, result); }
public void ModifyValueMultiply() { var modCol = new StatModifierCollection(OperatorType.Multiply); modCol.Set("a", 2); modCol.Set("b", 3); var result = modCol.ModifyValue(2); Assert.AreEqual(12, result); }
public void ModifyValueSubtract() { var modCol = new StatModifierCollection(OperatorType.Subtract); modCol.Set("a", 2); modCol.Set("b", 3); var result = modCol.ModifyValue(10); Assert.AreEqual(5, result); }
public void ModifyValueAdd() { var modCol = new StatModifierCollection(OperatorType.Add); modCol.Set("a", 2); modCol.Set("b", 3); var result = modCol.ModifyValue(1); Assert.AreEqual(6, result); }
public void SetByIdAddsToList() { var modCol = new StatModifierCollection(OperatorType.Add); modCol.Set("asdf", 22.4f); Assert.IsTrue(modCol.ListValues.Any(v => v.id == "asdf")); }
public void GetById() { var modCol = new StatModifierCollection(OperatorType.Add); modCol.Set("asdf", 22); var result = modCol.Get("asdf"); Assert.AreEqual(22, result.value); }
public void RemoveById() { var modCol = new StatModifierCollection(OperatorType.Add); modCol.Set("asdf", 22.4f); modCol.Remove("asdf"); Assert.IsFalse(modCol.ListValues.Any(v => v.id == "asdf")); }
public void SetTriggersDirty() { var dirtyTriggered = false; var modCol = new StatModifierCollection(OperatorType.Add); modCol.onDirty += () => { dirtyTriggered = true; }; modCol.Set("asdf", 22); Assert.IsTrue(dirtyTriggered); }
public void SetByIdAutoRound() { var modCol = new StatModifierCollection(OperatorType.Add) { forceRound = true }; modCol.Set("asdf", 22.4f); var result = modCol.Get("asdf"); Assert.AreEqual(22, result.value); }
public void Negative_removes_a_percentage() { _col.Set("a", -0.05f); Assert.AreEqual(95, _col.ModifyValue(100)); }
public void SetByIdNull() { var modCol = new StatModifierCollection(OperatorType.Add); modCol.Set(null, 22); }