Ejemplo n.º 1
0
        public void Switcher_SwitchingPredicate_Success()
        {
            var swithcer = new DelegateSwitcher <Func <int> >(key => !Equals(key, 3));

            swithcer.RegisterAndSwitch(1, () => 1);
            Assert.AreEqual(1, swithcer.Active());
            swithcer.RegisterAndSwitch(2, () => 2);
            Assert.AreEqual(2, swithcer.Active());
            swithcer.RegisterAndSwitch(3, () => 3);
            Assert.AreEqual(2, swithcer.Active());
        }
Ejemplo n.º 2
0
        public void Switcher_DelegateRegisterAndSwitch_Success()
        {
            var swithcer = new DelegateSwitcher <Func <int> >();

            Assert.IsNull(swithcer.Active);
            swithcer.RegisterAndSwitch(1, () => 1);
            Assert.IsNotNull(swithcer.Active);
            Assert.AreEqual(1, swithcer.Active());
        }
Ejemplo n.º 3
0
 public IExpression CreateInstance()
 {
     return((IExpression)_factory.Active());
 }