Пример #1
0
        public void Test_TryMatchAllRuleConditions_AllFalse(int nRules)
        {
            Faker faker = new Faker();

            IRoutedCacheClientRuleCondition[] conditions =
                new IRoutedCacheClientRuleCondition[nRules];

            for (int i = 0; i < nRules; i++)
            {
                conditions[i] = new AlwaysFalseCacheClientRuleCondition();
            }

            MatchAllRuleCondition cond = new MatchAllRuleCondition(conditions);

            Assert.IsFalse(cond.Matches(faker.Random.AlphaNumeric(10)));
        }
Пример #2
0
        public void Test_TryMatchAnyRuleConditions_SomeFalse(int nTruthyRules, int nFalsyRules)
        {
            Faker faker = new Faker();

            IRoutedCacheClientRuleCondition[] conditions =
                new IRoutedCacheClientRuleCondition[nTruthyRules + nFalsyRules];

            for (int i = 0; i < nTruthyRules; i++)
            {
                conditions[i] = new AlwaysTrueCacheClientRuleCondition();
            }

            for (int i = 0; i < nFalsyRules; i++)
            {
                conditions[i + nTruthyRules] = new AlwaysFalseCacheClientRuleCondition();
            }

            MatchAnyRuleCondition cond = new MatchAnyRuleCondition(conditions);

            Assert.IsTrue(cond.Matches(faker.Random.AlphaNumeric(10)));
        }