コード例 #1
0
        public void TestGlobalCountersDisabled()
        {
            ControlFactoryCounters target = new ControlFactoryCounters();

            Assert.IsFalse(target.IsGlobalCounterEnabled, "Global counter not disabled by default");
            Assert.AreEqual(0, target.GetGlobalCount(), "Count not initially zero");

            target.IncrementGlobalCount();
            Assert.AreEqual(0, target.GetGlobalCount(), "Global count incorrectly incremented when disabled");
        }
コード例 #2
0
        public void TestGlobalCountersEnabled()
        {
            ControlFactoryCounters target = new ControlFactoryCounters();

            Assert.IsFalse(target.IsGlobalCounterEnabled, "Global counter not disabled by default");
            target.IsGlobalCounterEnabled = true;
            Assert.IsTrue(target.IsGlobalCounterEnabled, "Global counter did not enable");
            Assert.AreEqual(0, target.GetGlobalCount(), "Count not initially zero");

            target.IncrementGlobalCount();
            Assert.AreEqual(1, target.GetGlobalCount());
            target.IncrementGlobalCount();
            Assert.AreEqual(2, target.GetGlobalCount());
        }