Exemplo n.º 1
0
        public void TestOnlyExternalIsRemoved()
        {
            string runtimePolicy = System.IO.Path.GetTempFileName();
            string myPolicy = System.IO.Path.GetTempFileName();

            try
            {
                OptionsExporter exporter = new OptionsExporter();

                exporter.Export(externalZipDisabled, contentPolicy, myPolicy, runtimePolicy, riskRatingsPath);

                PolicyTemplate modifedTemplate = new PolicyTemplate();
                modifedTemplate.Load(myPolicy);

                try
                {
                    IPolicy policy = modifedTemplate[TemplatePolicy.InternalZipPolicy];
                }
                catch
                {
                    Assert.IsTrue(false, "There should have been an internal zip policy");
                }
                IPolicy policy2 = modifedTemplate[TemplatePolicy.ExternalZipPolicy];
            }
            finally
            {
                System.IO.File.Delete(runtimePolicy);
                System.IO.File.Delete(myPolicy);
            }
        }
Exemplo n.º 2
0
        public void TestInternalIsRemoved()
        {
            OptionsExporter exporter = new OptionsExporter();

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

            exporter.Export(internalExternalZipDisabled, contentPolicy, myPolicy, runtimePolicy, riskRatingsPath);

            PolicyTemplate modifedTemplate = new PolicyTemplate();
            modifedTemplate.Load(myPolicy);

            IPolicy policy = modifedTemplate[TemplatePolicy.InternalZipPolicy];
        }
Exemplo n.º 3
0
        public void TestExportContentPolicyExports()
        {
            OptionsExporter exporter = new OptionsExporter();
            string runtimePolicy = System.IO.Path.GetTempFileName();
            string myPolicy = System.IO.Path.GetTempFileName();

            exporter.Export(optionsxml, contentPolicy, myPolicy, runtimePolicy, riskRatingsPath);
            System.IO.FileInfo fi1 = new System.IO.FileInfo(runtimePolicy);
            System.IO.FileInfo fi2 = new System.IO.FileInfo(myPolicy);
            Assert.IsTrue(fi1.Length > 0);
            Assert.IsTrue(fi2.Length > 0);

            System.IO.File.Delete(runtimePolicy);
            System.IO.File.Delete(myPolicy);
        }
Exemplo n.º 4
0
 public void TestLoadCleanPolicy()
 {
     OptionsExporter oe = new OptionsExporter();
     oe.Export(optionsxml, contentPolicy, "c:\\2.policy", "c:\\2.runtimepolicy", riskRatingsPath);
 }