Inheritance: IResource, IDeepCompare
Exemple #1
0
        public void TestRuleDeserialize_01()
        {
            Rule rule = new Rule(RuleType.Actor, "foo");

            string str = XmlHelper.Instance.ToXmlString<Rule>(rule);
            Rule des = XmlHelper.Instance.FromXmlString<Rule>(str);
            Assert.IsTrue(rule.DeepEquals(des));
        }
Exemple #2
0
        public void TestRuleSerialize_01()
        {
            Rule rule = new Rule(RuleType.Actor, "foo");

            string str = XmlHelper.Instance.ToXmlString<Rule>(rule);
            Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<rule xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" type=\"actor\">foo</rule>",
                str);
        }
Exemple #3
0
        public void TestRuleConstructor_01()
        {
            DateTime now = DateTime.Now;

            Rule rule = new Rule();
            rule.Type = RuleType.Actor;
            rule.Value = "foo";

            Rule rule2 = new Rule(RuleType.Actor,  "foo");

            Assert.AreEqual(rule.Type, RuleType.Actor);
            Assert.AreEqual(rule.Value, "foo");

            Assert.IsTrue(rule.DeepEquals(rule2));
        }
Exemple #4
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(Rule that)
        {
            if (this == that)
                return true;
            else if (that == null)
                return false;

            if (string.Equals(this.Type, that.Type) &&
                string.Equals(this.Value, that.Value))
            {
                return true;
            }
            else
            {
                return false;
            }
        }