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()); }
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()); }
public IExpression CreateInstance() { return((IExpression)_factory.Active()); }