public void TestDeepCopy() { RoutingItemCollections group = new RoutingItemCollections(Guid.NewGuid(), "LocationsCollection"); RoutingItemCollection collection1 = new RoutingItemCollection(Guid.NewGuid(), "Collection1"); RoutingItemCollection collection2 = new RoutingItemCollection(Guid.NewGuid(), "Collection1"); RoutingItemCollection collection3 = new RoutingItemCollection(Guid.NewGuid(), "Collection3"); group.Add(collection1); group.Add(collection2); group.Add(collection3); RoutingItemCollections group2 = group.DeepCopy(true) as RoutingItemCollections; Assert.AreEqual(3, group.Count); Assert.AreEqual(group2.Name, group.Name); Assert.AreEqual(group2.Count, group.Count); Assert.IsTrue(group2.ReadOnly); }
public void TestCopyConstruct() { RoutingItemCollections group = new RoutingItemCollections(Guid.NewGuid(), "LocationsCollection"); RoutingItemCollection collection1 = new RoutingItemCollection(Guid.NewGuid(), "Collection1"); RoutingItemCollection collection2 = new RoutingItemCollection(Guid.NewGuid(), "Collection1"); RoutingItemCollection collection3 = new RoutingItemCollection(Guid.NewGuid(), "Collection3"); group.Add(collection1); group.Add(collection2); group.Add(collection3); RoutingItemCollections group2 = new RoutingItemCollections(group); Assert.AreEqual(3, group.Count); Assert.AreEqual(group2.Name.Value, group.Name.Value); Assert.AreEqual(group2.Count, group.Count); Assert.AreEqual(group2.ReadOnly, group.ReadOnly); }
public void TestConstruct() { RoutingItemCollections group = new RoutingItemCollections(Guid.NewGuid(), "LocationsCollection"); RoutingItemCollection collection1 = new RoutingItemCollection(Guid.NewGuid(), "Collection1"); group.Add(collection1); Assert.AreEqual("LocationsCollection", group.Name.Value); Assert.AreEqual(1, group.Count); }
public static IRoutingItemCollections BuildRecipientGroup() { IRoutingItemCollections addressGroup = new RoutingItemCollections(Guid.Empty, ""); IRoutingItemCollection recipients = new RoutingItemCollection(new Guid("{FA13BE82-9EB1-407E-9DD5-8005F3E840E4}"), "{50042595-6053-486A-B93D-961E20994C3F}"); recipients.Add(new RoutingItem(new Guid("{7833C99B-BA46-48C5-B9FF-44718A4E5D9F}"), "Ann", "[email protected]")); recipients.Add(new RoutingItem(new Guid("{77D2EF11-9EC5-4C51-ACF7-D62B21F24F55}"), "Sally", "[email protected]")); addressGroup.Add(recipients); IRoutingItemCollection dodgyRecipients = new RoutingItemCollection(new Guid("{13A8EBE5-8B1E-4919-82E2-8A860DE4043E}"), "{ABEDA70D-DCED-4DA1-90E4-C16F188DB2D9}"); dodgyRecipients.Add(new RoutingItem(new Guid("{D77BA793-023D-44F6-BC08-1B4BF9217087}"), "WieIs", "[email protected]")); dodgyRecipients.Add(new RoutingItem(new Guid("{33FC2B8A-F8F5-4366-BA4F-01C1F6534FE9}"), "JoeMama", "[email protected]")); addressGroup.Add(dodgyRecipients); return addressGroup; }
public static IRoutingItemCollections BuildSenderGroup() { IRoutingItemCollections addressGroup = new RoutingItemCollections(Guid.Empty, ""); IRoutingItemCollection senders = new RoutingItemCollection(new Guid("{A81631A6-6AA3-45F7-AADD-4853447E5BD6}"), "{E71D6CE9-77B6-4246-A7B5-E0F8BCE65742}"); senders.Add(new RoutingItem(new Guid("{625C4BDE-907F-4751-BDA1-0E59EDBBCE5C}"), "James", "[email protected]")); senders.Add(new RoutingItem(new Guid("{6970F70A-B28D-4694-AEFA-C3D687F56112}"), "Jane", "[email protected]")); addressGroup.Add(senders); IRoutingItemCollection dodgySenders = new RoutingItemCollection(new Guid("{0DAACC5C-6167-42C7-AED0-55D1D9CC5096}"), "{30394243-1498-43C6-9732-0EE96AD2CC77}"); dodgySenders.Add(new RoutingItem(new Guid("{55B21D2B-6D35-42AD-B6EB-83632F2538D0}"), "JoeMa", "[email protected]")); dodgySenders.Add(new RoutingItem(new Guid("{29B963D7-F4A9-48A3-9F15-19434CE7FAA6}"), "Se", "[email protected]")); addressGroup.Add(dodgySenders); return addressGroup; }
public void TestCollection() { RoutingItemCollections group = new RoutingItemCollections(Guid.NewGuid(), "LocationsCollection"); RoutingItemCollection collection1 = new RoutingItemCollection(Guid.NewGuid(), "Collection1"); RoutingItemCollection collection2 = new RoutingItemCollection(Guid.NewGuid(), "Collection1"); RoutingItemCollection collection3 = new RoutingItemCollection(Guid.NewGuid(), "Collection3"); group.Add(collection1); group.Add(collection2); group.Add(collection3); RoutingItem address1 = new RoutingItem("Name1", "Address1"); RoutingItem address2 = new RoutingItem("Name2", "Address2"); RoutingItem address3 = new RoutingItem("Name3", "Address3"); RoutingItem address4 = new RoutingItem("Name4", "Address4"); RoutingItem address5 = new RoutingItem("Name5", "Address5"); RoutingItem address6 = new RoutingItem("Name6", "Address6"); collection1.Add(address1); collection1.Add(address2); collection1.Add(address3); collection2.Add(address4); collection2.Add(address5); collection3.Add(address6); Assert.AreEqual(3, collection1.Count); Assert.AreEqual(2, collection2.Count); Assert.AreEqual(1, collection3.Count); RoutingItem address = group[2][0] as RoutingItem; Assert.AreEqual("Name6", address.Name.Value); Assert.AreEqual("Address6", address.Content); address = group[1][1] as RoutingItem; Assert.AreEqual("Name5", address.Name.Value); Assert.AreEqual("Address5", address.Content); address = group[0][0] as RoutingItem; Assert.AreEqual("Name1", address.Name.Value); Assert.AreEqual("Address1", address.Content); }
public static IRoutingItemCollections BuildAddressGroup(string[] addressCollection, List<string[]> addresses) { IRoutingItemCollections addressGroup = new RoutingItemCollections(Guid.Empty, ""); IRoutingItemCollection senders = new RoutingItemCollection(new Guid(addressCollection[0]), addressCollection[1]); foreach (string[] address in addresses) { senders.Add(new RoutingItem(new Guid(address[0]), address[1], address[2])); } addressGroup.Add(senders); IRoutingItemCollection dodgySenders = new RoutingItemCollection(new Guid("{0DAACC5C-6167-42C7-AED0-55D1D9CC5096}"), "{30394243-1498-43C6-9732-0EE96AD2CC77}"); dodgySenders.Add(new RoutingItem(new Guid("{55B21D2B-6D35-42AD-B6EB-83632F2538D0}"), "JoeMa", "[email protected]")); dodgySenders.Add(new RoutingItem(new Guid("{29B963D7-F4A9-48A3-9F15-19434CE7FAA6}"), "Se", "[email protected]")); addressGroup.Add(dodgySenders); return addressGroup; }
public static IRoutingItemCollections BuildGroup(List<IRoutingItemCollection> addressCollections) { IRoutingItemCollections addressGroup = new RoutingItemCollections(Guid.Empty, ""); foreach (RoutingItemCollection addressCollection in addressCollections) { addressGroup.Add(addressCollection); } return addressGroup; }
private IRoutingItemCollections ReadAddressGroup(XmlNodeList addressCollectionIdNode, IRoutingItemCollections entireAddressGroup, bool routingTableReadOnly) { bool addressCollectionsReadOnly = false; if (addressCollectionIdNode.Count > 0) { XmlNode node = addressCollectionIdNode[0].ParentNode; addressCollectionsReadOnly = PolicyUtilities.IsReadOnly(node); } IRoutingItemCollections addressGroup = new RoutingItemCollections(Guid.Empty, "", routingTableReadOnly || addressCollectionsReadOnly); List<string> exclusions = new List<string>(); exclusions.Add("id"); exclusions.Add("readonly"); foreach (XmlNode addressIdNode in addressCollectionIdNode) { string addressId = addressIdNode.Attributes.GetNamedItem("id").InnerText; bool readOnly = PolicyUtilities.IsReadOnly(addressIdNode); RoutingItemCollection currentCollection = entireAddressGroup[new Guid(addressId)] as RoutingItemCollection; if (currentCollection != null) { RoutingItemCollection copiedCollection = new RoutingItemCollection(currentCollection, readOnly, false); new XmlCustomAttributesReader(copiedCollection, addressIdNode.Attributes, exclusions).Read(); addressGroup.Add(copiedCollection); } } return addressGroup; }