Пример #1
0
        public void InstanceDisposed_decreases_LivingCount()
        {
            var c = new InstanceCounter();
            c.InstanceCreated();

            c.InstanceDisposed();

            Assert.AreEqual(1, c.CreatedCount);
            Assert.AreEqual(1, c.DisposedCount);
            Assert.AreEqual(0, c.FinalizedCount);
            Assert.AreEqual(0, 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);
        }