コード例 #1
0
        public void BasicStatTest()
        {
            Stat hp = new Stat(0, 100, 100, false);

            Assert.AreEqual(100, hp.GetCurrent());
            Assert.AreEqual(100, hp.GetMax());
            Assert.AreEqual(0, hp.GetMin());

            hp.AddCurrent(10);
            Assert.AreEqual(100, hp.GetCurrent()); // not allowed to go over max

            hp.AddCurrent(-30);
            Assert.AreEqual(70, hp.GetCurrent());

            hp.SetCurrent(10);
            Assert.AreEqual(10, hp.GetCurrent());

            hp.AddCurrent(-30);
            Assert.AreEqual(0, hp.GetCurrent()); // not allowed to go under min
        }