public void TestPublisherSerialize_01() { Publishers publishers = new Publishers(); publishers.Items.Add(new Publisher(PublisherType.My, "foobar1", RuleType.Actor, RuleType.Tag)); publishers.Items.Add(new Publisher(PublisherType.My, "foobar2", RuleType.Actor, RuleType.Tag)); publishers.Items.Add(new Publisher(PublisherType.My, "foobar3", RuleType.Actor, RuleType.Tag)); string str = XmlHelper.Instance.ToXmlString<Publishers>(publishers); Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<publishers xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + "<publisher name=\"foobar1\">" + "<supportedRuleTypes>" + "<type>actor</type>" + "<type>tag</type>" + "</supportedRuleTypes>" + "</publisher>" + "<publisher name=\"foobar2\">" + "<supportedRuleTypes>" + "<type>actor</type>" + "<type>tag</type>" + "</supportedRuleTypes>" + "</publisher>" + "<publisher name=\"foobar3\">" + "<supportedRuleTypes>" + "<type>actor</type>" + "<type>tag</type>" + "</supportedRuleTypes>" + "</publisher>" + "</publishers>", str); }
public void TestPublisherConstructor_01() { Publishers publishers = new Publishers(); publishers.Items.Add(new Publisher(PublisherType.My, "foobar1", RuleType.Actor, RuleType.Tag)); publishers.Items.Add(new Publisher(PublisherType.My, "foobar2", RuleType.Actor, RuleType.Tag)); publishers.Items.Add(new Publisher(PublisherType.My, "foobar3", RuleType.Actor, RuleType.Tag)); Assert.AreEqual(3, publishers.Items.Count); }
/// <summary> /// Determins if this equals that by performing a deep equals /// looking at all elements of all member listsand objects. /// </summary> /// <param name="that">The object to compare for equality.</param> /// <returns>True if this is equal to that, false otherwise.</returns> public bool DeepEquals(Publishers that) { if (this == that) return true; else if (that == null) return false; return ListUtils.AreDeepEqual<Publisher>(this.Items, that.Items); }
public void TestPublisherDeserialize_01() { Publishers publishers = new Publishers(); publishers.Items.Add(new Publisher(PublisherType.Gnip, "foobar1", RuleType.Actor, RuleType.Tag)); publishers.Items.Add(new Publisher(PublisherType.Gnip, "foobar2", RuleType.Actor, RuleType.Tag)); publishers.Items.Add(new Publisher(PublisherType.Gnip, "foobar3", RuleType.Actor, RuleType.Tag)); string str = XmlHelper.Instance.ToXmlString<Publishers>(publishers); Publishers des = XmlHelper.Instance.FromXmlString<Publishers>(str); Assert.AreEqual(3, des.Items.Count); for (int idx = 0; idx < des.Items.Count; idx++) { Assert.IsTrue(publishers.Items[idx].DeepEquals(des.Items[idx])); } }