public void TestProcessMessageContent_MultipleViolations()
        {
            string rulesxml = System.IO.File.ReadAllText(@"P:\projects\Hygiene\src\TestDocuments\TestProcessMessageContentRules.xml");
            string objectsxml = System.IO.File.ReadAllText(@"P:\projects\Hygiene\src\TestDocuments\TestProcessMessageContentObjects.xml");

            Workshare.Policy.Engine.EmailPolicyEngine engine = new Workshare.Policy.Engine.EmailPolicyEngine();
            IRuleStore store = new MockRuleStore(rulesxml, objectsxml);

            MockEmailPolicyAuditor auditor = new MockEmailPolicyAuditor();

            engine.SetRuleStore(store);
            engine.SetPolicyAuditor(auditor);

            string bodyText = "4408 0412 3456 7890 piss";

            List<string> attachmentNames = new List<string>();
            attachmentNames.Add("attachment1");
            attachmentNames.Add("F**k");
            attachmentNames.Add("c**t");

            FileRouting fileRouting = engine.ProcessMessageContent(RunAtMode.Client, "Random subject", bodyText, attachmentNames);

            EventEntity documentEvent = fileRouting.DocumentEntity.DocumentEvents[0];
            ConditionRuleEntity privacyRule = documentEvent.ConditionRules[0];

            Assert.IsTrue(privacyRule.ConditionRuleName == "Privacy");
            Assert.IsTrue(privacyRule.Violated == true);
            Assert.IsTrue(privacyRule.Conditions[0].ConditionData == "Possible Social Security Number");
            Assert.IsTrue(privacyRule.Conditions[0].ConditionViolated == false);
            Assert.IsTrue(privacyRule.Conditions[1].ConditionData == "Possible Credit Card Number");
            Assert.IsTrue(privacyRule.Conditions[1].ConditionViolated == true);
            Assert.IsTrue(privacyRule.Conditions[1].ConditionProperties[0].Name == "Body");
            Assert.IsTrue(privacyRule.Conditions[1].ConditionProperties[0].PropertyValue == "4408 0412 3456 7890");

            ConditionRuleEntity profanityRule = documentEvent.ConditionRules[1];

            Assert.IsTrue(profanityRule.ConditionRuleName == "Profanity");
            Assert.IsTrue(profanityRule.Violated == true);
            Assert.IsTrue(profanityRule.Conditions[0].ConditionProperties[0].Name == "Body");
            Assert.IsTrue(profanityRule.Conditions[0].ConditionProperties[0].PropertyValue == "piss");
            Assert.IsTrue(profanityRule.Conditions[0].ConditionProperties[1].Name == "Attachments");
            Assert.IsTrue(profanityRule.Conditions[0].ConditionProperties[1].PropertyValue == "F**k");
            Assert.IsTrue(profanityRule.Conditions[0].ConditionProperties[2].Name == "Attachments");
            Assert.IsTrue(profanityRule.Conditions[0].ConditionProperties[2].PropertyValue == "c**t");

            Assert.IsTrue(profanityRule.Conditions[0].ConditionData == "The Seven Dirty Words! and some...");
        }
        public void TestProcessMessageContent_NoViolation()
        {
            string rulesxml = System.IO.File.ReadAllText(@"P:\projects\Hygiene\src\TestDocuments\TestProcessMessageContentRules.xml");
            string objectsxml = System.IO.File.ReadAllText(@"P:\projects\Hygiene\src\TestDocuments\TestProcessMessageContentObjects.xml");

            Workshare.Policy.Engine.EmailPolicyEngine engine = new Workshare.Policy.Engine.EmailPolicyEngine();
            IRuleStore store = new MockRuleStore(rulesxml, objectsxml);

            MockEmailPolicyAuditor auditor = new MockEmailPolicyAuditor();

            engine.SetRuleStore(store);
            engine.SetPolicyAuditor(auditor);

            string bodyText = "Body Text with no violation";

            List<string> attachmentNames = new List<string>();
            attachmentNames.Add("attachment1");
            attachmentNames.Add("attachment2");
            attachmentNames.Add("attachment3");

            FileRouting fileRouting = engine.ProcessMessageContent(RunAtMode.Client, "Random subject", bodyText, attachmentNames);

            EventEntity documentEvent = fileRouting.DocumentEntity.DocumentEvents[0];
            ConditionRuleEntity privacyRule = documentEvent.ConditionRules[0];
            ConditionRuleEntity profanityRule = documentEvent.ConditionRules[1];

            Assert.IsTrue(privacyRule.ConditionRuleName == "Privacy");
            Assert.IsFalse(privacyRule.Violated);
            Assert.IsTrue(profanityRule.ConditionRuleName == "Profanity");
            Assert.IsFalse(profanityRule.Violated);
        }