public override bool Equals(object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return(false);
            }

            // If parameter cannot be cast to ConditionTreeLeaf return false.
            ConditionTreeLeaf o = obj as ConditionTreeLeaf;

            if ((System.Object)o == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return(Type.Equals(o.Type) &&
                   Comparison.Equals(o.Comparison) &&
                   VariableName.Equals(o.VariableName) &&
                   CompareTo.Equals(o.CompareTo));
        }
        public void TestConditionParserValidConditions()
        {
            var horizontal = new ConditionTreeLeaf(ConditionType.State, "horizontal", ConditionComparison.Equal, new PropertyUnion(true));
            var propertyEq1 = new ConditionTreeLeaf(ConditionType.Property, "Property", ConditionComparison.Equal, new PropertyUnion(1));

            var conditionTests = new Dictionary<string, IConditionTreeItem>()
            {
                { "horizontal", horizontal},
                { "$Property==1", propertyEq1},
                { "horizontal|$Property==1", new ConditionTree(ConditionTree.ConditionOperator.OR, horizontal, propertyEq1)},
                { "horizontal,$Property==1", new ConditionTree(ConditionTree.ConditionOperator.AND, horizontal, propertyEq1)}
            };

            var parseContext = new ParseContext();
            parseContext.PropertyTypes.Add(new KeyValuePair<string,PropertyUnionType>("Property", PropertyUnionType.Double));

            ConditionParser parser = new ConditionParser(new ConditionFormat() { StatesUnderscored = false });
            foreach(var test in conditionTests)
            {
                var parsed = parser.Parse(test.Key, parseContext);
                Assert.AreEqual(test.Value, parsed);
            }
        }