Пример #1
0
        public void TestProcessActions_MetaDataViolation()
        {
            string rulesxml = System.IO.File.ReadAllText(@"P:\projects\Hygiene\src\TestDocuments\TestProcessActionsRules.xml");
            string objectsxml = System.IO.File.ReadAllText(@"P:\projects\Hygiene\src\TestDocuments\TestProcessActionsObjects.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 = "This is a safe email";

            List<IFile> files = new List<IFile>();
            files.Add(new Workshare.Policy.Engine.File(@"P:\projects\Hygiene\src\TestDocuments\Dirty.doc", "Dirty"));
            
            List<FileRouting> fileRoutings = engine.ProcessFiles(RunAtMode.Client, files);

            string from = @"*****@*****.**";
            List<string> to = new List<string>();
            to.Add(@"*****@*****.**");
            to.Add(@"*****@*****.**");

            List<string> cc = new List<string>();
            List<string> bcc = new List<string>();

            List<FileActions> fileActions = engine.ProcessRoutings(RunAtMode.Client, fileRoutings, from, to.ToArray(), cc.ToArray(), bcc.ToArray());
            Assert.IsTrue(fileActions[0].ActionObjects[0].Name == "HD_Remove");
            List<IFile> processedFiles = engine.ProcessActions(RunAtMode.Client, fileActions);
            Assert.IsTrue(processedFiles.Count == 1);
        }