Ejemplo n.º 1
0
        public CataloguePolicy(CataloguePolicy rhs, bool readOnly, bool createNewId)
            : base(rhs, readOnly, createNewId)
        {
            if (null == rhs)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "INPUT_POLICY_NULL",
                    "Workshare.Policy.Properties.Resources",
                    Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
                throw new Workshare.Policy.Exceptions.ArgumentNullException("rhs", errorMessage.DisplayString);
            }

            m_status = rhs.Status;
        }
Ejemplo n.º 2
0
        public void TestWriteRule()
        {
            string testCatalogue = m_testPath + "TestRealPolicyCatalogue.xml";
            string testLanguage = m_testPath + "TestRealPolicyLanguage.xml";

            XmlPolicyLanguageStore.Instance.AddLanguage(System.IO.File.ReadAllText(testLanguage));

            XMLPolicyCatalogueStore catalogueStore = XMLPolicyCatalogueStore.Instance;
            PolicyCatalogue policyCatalogue = catalogueStore.AddPolicyCatalogue(System.IO.File.ReadAllText(testCatalogue));

            XmlStore store = new XmlStore();

            Store.IPolicyStoreWriter writer = store.Writer;
            Assert.IsNotNull(writer, "Expected a valid [IPolicyStoreWriter] writer");

            ObjectModel.PolicySet policySet = new ObjectModel.PolicySet(new Guid("{8FC9EB93-C376-4E96-B22E-71FAA848393D}"), new TranslateableLanguageItem("{D803727B-5C81-44CC-8BFC-9B68797AC6EB}"), store, policyCatalogue, false);
            writer.WritePolicySet(policySet);

            ICataloguePolicy cataloguePolicy = new CataloguePolicy(new Guid("{8E915159-5F01-41B3-9FFF-20731544ADFA}"), new TranslateableLanguageItem("{F0DD86A0-5D21-4784-88AF-C5321B5998F6}"), PolicyStatus.Disabled);
            writer.WritePolicy(policySet, cataloguePolicy);
            writer.Close();

            TestHelpers.CompareXml(m_testPath + "ExpectedWriteRule.xml", store.StoreXML);
        }