public void TestWriteMultiplePolicies() { 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); P5Policy policy = new P5Policy(store, policySet, new Guid("{C0F6D4BB-CBF1-41FC-8A28-616D6FC1DC73}"), new TranslateableLanguageItem("{F0DD86A0-5D21-4784-88AF-C5321B5998F6}"), PolicyStatus.Active); writer.WritePolicySet(policySet); writer.WritePolicy(policySet, policy); IPolicyObjectCollection<IPolicyObject> conditions = new PolicyObjectCollection<IPolicyObject>(BuildConditions() as PolicyObjectCollection<IPolicyObject>); writer.WriteChildCollection(policySet, policy, policy.Name.Value, conditions); ObjectModel.PolicySet policySet2 = new ObjectModel.PolicySet(new Guid("{807F2757-373C-4629-AB4E-F0AEB3DE447B}"), new TranslateableLanguageItem("{F7916FE9-8871-4650-A3ED-9597A3F91A74}"), store, policyCatalogue, false); writer.WritePolicySet(policySet2); writer.WritePolicy(policySet2, policy); conditions.RemoveAt(0); writer.WriteChildCollection(policySet2, policy, policy.Name.Value, conditions); writer.Close(); TestHelpers.CompareXml(m_testPath + "ExpectedWriteMultiplePolicies.xml", store.StoreXML); }