Пример #1
0
        public void isSatisfied()
        {
            Assert.IsFalse(satisfiedRule.And(BooleanRule.FALSE).IsSatisfied(0));
            Assert.IsFalse(BooleanRule.FALSE.And(satisfiedRule).IsSatisfied(0));
            Assert.IsFalse(unsatisfiedRule.And(BooleanRule.FALSE).IsSatisfied(0));
            Assert.IsFalse(BooleanRule.FALSE.And(unsatisfiedRule).IsSatisfied(0));

            Assert.IsTrue(satisfiedRule.And(BooleanRule.TRUE).IsSatisfied(10));
            Assert.IsTrue(BooleanRule.TRUE.And(satisfiedRule).IsSatisfied(10));
            Assert.IsFalse(unsatisfiedRule.And(BooleanRule.TRUE).IsSatisfied(10));
            Assert.IsFalse(BooleanRule.TRUE.And(unsatisfiedRule).IsSatisfied(10));
        }
Пример #2
0
        public void IsSatisfied()
        {
            Assert.IsFalse(_satisfiedRule.And(BooleanRule.False).IsSatisfied(0));
            Assert.IsFalse(BooleanRule.False.And(_satisfiedRule).IsSatisfied(0));
            Assert.IsFalse(_unsatisfiedRule.And(BooleanRule.False).IsSatisfied(0));
            Assert.IsFalse(BooleanRule.False.And(_unsatisfiedRule).IsSatisfied(0));

            Assert.IsTrue(_satisfiedRule.And(BooleanRule.True).IsSatisfied(10));
            Assert.IsTrue(BooleanRule.True.And(_satisfiedRule).IsSatisfied(10));
            Assert.IsFalse(_unsatisfiedRule.And(BooleanRule.True).IsSatisfied(10));
            Assert.IsFalse(BooleanRule.True.And(_unsatisfiedRule).IsSatisfied(10));
        }
Пример #3
0
 public IStrategy And(string name, IStrategy strategy, int unstablePeriod)
 {
     return(new BaseStrategy(name, _entryRule.And(strategy.EntryRule), _exitRule.And(strategy.ExitRule), unstablePeriod));
 }
Пример #4
0
 /// <summary>
 /// Logical operator AND.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="rule1"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public static AndRule <T> And <T>(this IRule <T> rule1, T value) where T : IEquatable <T> => rule1.And(new IsRule <T>(value));