Example #1
0
        public void TestSave()
        {
            PolicyTemplate template = new PolicyTemplate();
            template.Load(policy_file);

            Options options = new Options(optionsxml);

            ZipPolicy zipPolicy = new ZipPolicy(template, options);
            zipPolicy.Apply();

            string runtimePolicy = System.IO.Path.GetTempFileName();
            string myPolicy = System.IO.Path.GetTempFileName();
            template.Save(myPolicy, runtimePolicy);

            Assert.IsTrue(System.IO.File.Exists(runtimePolicy));
            System.IO.FileInfo fi = new System.IO.FileInfo(runtimePolicy);
            Assert.IsTrue(fi.Length > 0);
            System.IO.File.Delete(runtimePolicy);
            System.IO.File.Delete(myPolicy);
        }
Example #2
0
        public void TestModifyActionProperties()
        {
            PolicyTemplate template = new PolicyTemplate();
            template.Load(policy_file);
            IAction zipAction = template[TemplatePolicy.InternalZipPolicy, ChannelType.SMTP, Routing.Internal].Values[0];
            
            IDataItem value1 = zipAction.DataElements[new Guid("{252635eb-d7ff-44be-bc43-eb35356cebb1}")].Data as IDataItem;
            value1.Value = true;

            bool orginal = (bool)(value1.Value);

            Options options = new Options(optionsxml);
            ZipPolicy zipPolicy = new ZipPolicy(template, options);
            zipPolicy.Apply();

            IDataItem value2 = zipAction.DataElements[new Guid("{252635eb-d7ff-44be-bc43-eb35356cebb1}")].Data as IDataItem;
            bool modifed = (bool)(value2.Value);

            Assert.AreNotEqual(modifed, orginal, "The data element's value should have been modified");
        }