internal void Start(MailContext mailContext)
 {
     _main.Process(mailContext);
 }
 private void GeneralHandler(MailContext context)
 {
     Console.WriteLine("Email handled by general enquiries");
 }
 private bool WordPredicate(MailContext context, IEnumerable <string> matchingWords)
 {
     return(matchingWords.Count() == 0 ||
            !(matchingWords.FirstOrDefault(w => context.MailContent.ToUpper().Contains(w.ToUpper())) is null));
 }
 private void ServiceHandler(MailContext context)
 {
     Console.WriteLine("Email handled by service department");
 }
 private bool GeneralPredicate(MailContext context)
 {
     return(WordPredicate(context, new string[0]));
 }
 private void ManagerHandler(MailContext context)
 {
     Console.WriteLine("Email handled by manager");
 }
 private bool ServicePredicate(MailContext context)
 {
     return(WordPredicate(context, new string[] { "service", "repair" }));
 }
 private bool ManagerPredicate(MailContext context)
 {
     return(WordPredicate(context, new string[] { "complain", "bad" }));
 }
 private void SalesHandler(MailContext context)
 {
     Console.WriteLine("Email handled by sales department");
 }
 private bool SalesPredicate(MailContext context)
 {
     return(WordPredicate(context, new string[] { "buy", "purchase" }));
 }
 private void SpamHandler(MailContext context)
 {
     Console.WriteLine("this is a spam mail!!");
 }
 private bool SpamPredicate(MailContext context)
 {
     return(WordPredicate(context, new string[] { "viagra", "pills", "medecines" }));
 }