예제 #1
0
        public void CheckingUsesTheInstance()
        {
            var checker = new MockChecker();
            FeatureCheckFactory.Checker = checker;

            Assert.IsTrue(Feature.Doughnuts.IsEnabled());
            Assert.AreEqual(Feature.Doughnuts, checker.Checked);
        }
예제 #2
0
        public void PerFeatureCheckerHasACheckerForEachFeature()
        {
            var doughnutchecker = new MockChecker();
            var timeChecker = new MockChecker();

            _pfc.Add(Feature.Doughnuts, doughnutchecker);
            _pfc.Add(Feature.TimeTravel, timeChecker);

            _pfc.Check(Feature.Doughnuts, null);
            Assert.AreEqual(Feature.Doughnuts, doughnutchecker.Checked);
            Assert.AreEqual(1, doughnutchecker.CheckCount);
            Assert.AreEqual(0, timeChecker.CheckCount);
        }
예제 #3
0
        public void TheFirstCheckerThatPassesWins()
        {
            var check1 = new MockChecker(false);
            var check2 = new MockChecker(false);

            _pfc.Add(Feature.Doughnuts, check1);
            _pfc.Add(Feature.Doughnuts, check2);

            Assert.False(_pfc.Check(Feature.Doughnuts, null));

            Assert.AreEqual(Feature.Doughnuts, check1.Checked);
            Assert.AreEqual(Feature.Doughnuts, check2.Checked);
            Assert.AreEqual(1, check1.CheckCount);
            Assert.AreEqual(1, check2.CheckCount);
        }