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); }
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); }