Esempio n. 1
0
        public void Check(EMail mail)
        {
            // Bootstrapping
            var ruleChecker =
                new RuleChecker(
                    new List<ISpamRule>
                {
                    new MyFirstRule(),
                    new MySecondRule(),
                    // …
                });

            ruleChecker.CheckMail(mail);

            // ...
        }
Esempio n. 2
0
        public SpamResult CheckMail(EMail mail)
        {
            foreach (var rule in _rules)
            {
                var result = rule.CheckMail(mail);

                if (result != SpamResult.Unknown)
                    return result;
            }

            return SpamResult.Unknown;
        }
Esempio n. 3
0
 private static SpamResult TestRule2(EMail mail)
 {
     // I don’t care about the concrete rules
     return SpamResult.Ok;
 }
Esempio n. 4
0
 public SpamResult CheckMail(EMail mail)
 {
     // I don’t care about this
     return SpamResult.Ok;
 }
Esempio n. 5
0
        public SpamResult CheckMail(EMail mail)
        {
            var result = TestRule1(mail);

            if (result != SpamResult.Unknown)
                return result;

            result = TestRule2(mail);
            if (result != SpamResult.Unknown)
                return result;

            // …
            return SpamResult.Unknown;
        }