예제 #1
0
        public void Test_OnUpdate()
        {
            var ddn = new NodeDestroyer ();
            var node = new Node ("DeadSoul");
            ddn.Reserve (node, 100);

            ddn.OnUpdate (33);

            Assert.AreEqual (100, ddn.GetReservation (0).PurgeTime);
            Assert.AreEqual (67, ddn.GetReservation (0).LifeTime);
        }
예제 #2
0
        public void Test_Purge()
        {
            var ddn = new NodeDestroyer ();
            ddn.Reserve (new Node ("DeadSoul"), 1);
            ddn.Reserve (new Node ("DeadSoul"), 2);
            ddn.Reserve (new Node ("DeadSoul"), 3);

            ddn.OnUpdate (0);
            ddn.Purge ();
            Assert.AreEqual (3, ddn.ReservationCount);

            ddn.OnUpdate (1);
            ddn.Purge ();
            Assert.AreEqual (2, ddn.ReservationCount);

            ddn.OnUpdate (2);
            ddn.Purge ();
            Assert.AreEqual (1, ddn.ReservationCount);

            ddn.OnUpdate (3);
            ddn.Purge ();
            Assert.AreEqual (0, ddn.ReservationCount);
        }
예제 #3
0
        public void Test_Reserve()
        {
            var ddn = new NodeDestroyer ();
            var node = new Node ("DeadSoul");
            ddn.Reserve (node, 100);

            Assert.AreEqual (1, ddn.ReservationCount);
            Assert.AreEqual (1, ddn.Reserves.Count ());
            Assert.AreEqual (node, ddn.GetReservation (0).Node);
            Assert.AreEqual (100, ddn.GetReservation (0).PurgeTime);
        }