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)); }
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); }
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)); }
/// <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; } }