Inheritance: IResource, IDeepCompare
Ejemplo n.º 1
0
        public void TestPublisherConstructor_01()
        {
            Rules rules = new Rules();
            rules.Items.Add(new Rule(RuleType.Actor, "actor1"));
            rules.Items.Add(new Rule(RuleType.Regarding, "regarding1"));
            rules.Items.Add(new Rule(RuleType.Source, "source1"));

            Assert.AreEqual(3, rules.Items.Count);
        }
Ejemplo n.º 2
0
        /// <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(Rules that)
        {
            if (this == that)
                return true;
            else if (that == null)
                return false;

            return ListUtils.AreDeepEqual<Rule>(this.Items, that.Items);
        }
Ejemplo n.º 3
0
        public void TestPublisherSerialize_01()
        {
            Rules rules = new Rules();
            rules.Items.Add(new Rule(RuleType.Actor, "actor1"));
            rules.Items.Add(new Rule(RuleType.Regarding, "regarding1"));
            rules.Items.Add(new Rule(RuleType.Source, "source1"));

            string str = XmlHelper.Instance.ToXmlString<Rules>(rules);

            Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-8\"?><rules xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
                                "<rule type=\"actor\">actor1</rule>" +
                                "<rule type=\"regarding\">regarding1</rule>" +
                                "<rule type=\"source\">source1</rule>" +
                            "</rules>", str);
        }
Ejemplo n.º 4
0
        public void TestPublisherDeserialize_01()
        {
            Rules rules = new Rules();
            rules.Items.Add(new Rule(RuleType.Actor, "actor1"));
            rules.Items.Add(new Rule(RuleType.Regarding, "regarding1"));
            rules.Items.Add(new Rule(RuleType.Source, "source1"));

            string str = XmlHelper.Instance.ToXmlString<Rules>(rules);
            Rules des = XmlHelper.Instance.FromXmlString<Rules>(str);

            Assert.AreEqual(3, des.Items.Count);
            for (int idx = 0; idx < des.Items.Count; idx++)
            {
                Assert.IsTrue(rules.Items[idx].DeepEquals(des.Items[idx]));
            }
        }