예제 #1
0
        public void TestUnSuccessfullParseReturnsToggleStatusInactive()
        {
            IToggleParser testParser     = new ToggleParserTestDouble();
            var           toggle         = new FeatureToggle <bool>();
            var           toggleResponse = toggle.GetToggleState(testParser, "anythingElse");

            Assert.AreEqual(ToggleStatus.Inactive, toggleResponse);
        }
예제 #2
0
        public void TestSuccessfullParseReturnsToggleStatusActive()
        {
            IToggleParser testParser     = new ToggleParserTestDouble();
            var           toggle         = new FeatureToggle <bool>();
            var           toggleResponse = toggle.GetToggleState(testParser, "positive");

            Assert.AreEqual(ToggleStatus.Active, toggleResponse);
        }
예제 #3
0
        public void TestUnSuccessfullFuncTestDataTypeCallWhenToggleStatusInactive()
        {
            IToggleParser       testParser = new ToggleParserTestDouble();
            var                 toggle     = new FeatureToggle <TestDataType>();
            Func <TestDataType> theAction  = AlwaysReturnNewTestDataType;

            var toggleResponse = toggle.ExecuteMethodIfToggleOn(theAction, testParser, "anythingElse");

            Assert.IsNull(toggleResponse);
        }
예제 #4
0
        public void TestSuccessfullFuncTestDataTypeCallWhenToggleStatusActive()
        {
            IToggleParser       testParser = new ToggleParserTestDouble();
            var                 toggle     = new FeatureToggle <TestDataType>();
            Func <TestDataType> theAction  = AlwaysReturnNewTestDataType;

            var toggleResponse = toggle.ExecuteMethodIfToggleOn(theAction, testParser, "positive");

            Assert.AreEqual(new TestDataType().HappynessIs, toggleResponse.HappynessIs);
        }
예제 #5
0
        public void TestUnSuccessfullFuncStringCallWhenToggleStatusInactive()
        {
            IToggleParser testParser = new ToggleParserTestDouble();
            var           toggle     = new FeatureToggle <string>();
            Func <string> theAction  = AlwaysReturnFire;

            var toggleResponse = toggle.ExecuteMethodIfToggleOn(theAction, testParser, "anythingElse");

            Assert.AreNotEqual("Fire", toggleResponse);
        }
예제 #6
0
        public void TestUnSuccessfullFuncCallWhenToggleStatusInactive()
        {
            IToggleParser testParser = new ToggleParserTestDouble();
            var           toggle     = new FeatureToggle <bool>();
            Func <bool>   theAction  = AlwaysReturnTrue;

            var toggleResponse = toggle.ExecuteMethodIfToggleOn(theAction, testParser, "anythingElse");

            Assert.AreEqual(false, toggleResponse);
        }