예제 #1
0
 public void InstanceCreated_increases_LivingCount()
 {
     var c = new InstanceCounter();
     Assert.AreEqual(0, c.LivingCount);
     
     c.InstanceCreated();
     Assert.AreEqual(1, c.CreatedCount);
     Assert.AreEqual(0, c.DisposedCount);
     Assert.AreEqual(0, c.FinalizedCount);
     Assert.AreEqual(1, c.LivingCount);
 }
예제 #2
0
        public void Reset_resets_all_counters()
        {
            var c = new InstanceCounter();
            c.InstanceCreated();
            c.InstanceCreated();
            c.InstanceDisposed();
            c.InstanceFinalized();

            c.Reset();
            Assert.AreEqual(0, c.CreatedCount);
            Assert.AreEqual(0, c.DisposedCount);
            Assert.AreEqual(0, c.FinalizedCount);
            Assert.AreEqual(0, c.LivingCount);
        }