コード例 #1
0
    public void StatsRaiseModifiedEventWhenValueSet()
    {
        var stat         = new BasicStat(20);
        var changeCalled = false;

        stat.Modified += (object sender, BasicStatModifiedEventArgs e) => {
            changeCalled = true;
        };

        stat.SetValue(21);
        Assert.True(changeCalled);
    }
コード例 #2
0
    public void StatsRaiseTheOldValueAndNewValue()
    {
        var  stat = new BasicStat(10);
        bool mod  = false;

        stat.Modified += (object sender, BasicStatModifiedEventArgs e) => {
            Assert.AreEqual(10, e.OldBaseValue);
            Assert.AreEqual(14, e.NewBaseValue);
            mod = true;
        };
        stat.SetValue(14);

        Assert.IsTrue(mod);
    }