public void TestSaveRemoveActionPersistsToTemplate()
        {
            PolicyTemplate template = new PolicyTemplate();
            template.Load(policy_file);

            SortedList<int, IAction> internalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.Internal];
            SortedList<int, IAction> externalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.External];

            Assert.AreEqual(1, internalActions.Count);
            Assert.AreEqual(1, externalActions.Count);

            IPolicyChannel pdfSmtpChannel = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP];
            template.RemoveAction(pdfSmtpChannel, Routing.Internal, internalActions.Values[0]);

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

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

            internalActions = updatedPolicy[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.Internal];
            externalActions = updatedPolicy[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.External];

            Assert.AreEqual(0, internalActions.Count);
            Assert.AreEqual(1, externalActions.Count);
        }
        public void TestRemoveAction()
        {
            PolicyTemplate template = new PolicyTemplate();
            template.Load(policy_file);

            SortedList<int, IAction> internalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.Internal];
            SortedList<int, IAction> externalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.External];

            Assert.AreEqual(1, internalActions.Count);
            Assert.AreEqual(1, externalActions.Count);

            IPolicyChannel pdfSmtpChannel = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP];

            template.RemoveAction(pdfSmtpChannel, Routing.Internal, internalActions.Values[0]);
            
            internalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.Internal];
            externalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.External];
            
            Assert.AreEqual(0, internalActions.Count);
            Assert.AreEqual(1, externalActions.Count);

            template.RemoveAction(pdfSmtpChannel, Routing.External, externalActions.Values[0]);

            internalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.Internal];
            externalActions = template[TemplatePolicy.PdfPolicy, ChannelType.SMTP, Routing.External];

            Assert.AreEqual(0, internalActions.Count);
            Assert.AreEqual(0, externalActions.Count);
        }