Ejemplo n.º 1
0
        public void TriggerOnNthCallTest()
        {
            int            n         = 3;
            ICondition     condition = BuiltInConditions.TriggerOnNthCall(n);
            RuntimeContext ctx       = new RuntimeContext();
            int            loopTimes = 20;

            for (int i = 0; i < loopTimes; ++i)
            {
                ctx.CalledTimes++;
                if (ctx.CalledTimes != n)
                {
                    Assert.False(condition.Trigger(ctx));
                }
                else
                {
                    Assert.True(condition.Trigger(ctx));
                }
            }
        }