Expressions_Comparison

advertisement
Old Expressions
New Expressions
<and><another term="or more"/></and>
<and><another term="or more"/></and>
Inherits List<XmlExpression>
Evaluation: returns false if one exp != true
Inherits IExpression[] Terms
Evaluation: : returns false if one exp != true
<or><another term="or more"/></or>
<or><another term="or more"/></or>
Inherits List<XmlExpression>
Evaluation: returns true if one exp == true
Inherits IExpression[] Terms
Evaluation: : returns true if one exp == true
<not><another term="or more"/></not>
<not><another term="or more"/></not>
Evaluates one singleExpresssion: !m_Expression.IsTrueFor(obj)
Evaluates one term
EvaluationResult.Not(term.evaluate)
<systemProperty name="FakeFiles" value="disabled"/>
<systemTest name="" value="" operator="{undefined, exists,
equals}" type="" suppressValueConversion="{true, false}" />
<property name="" value="" operator="{undefined, exists,
equals}" type="" suppressValueConversion="{true, false}" />
Evaluation not implemented...
ObjectProperty:
<property name ="TestProperty" value="Test.Something"
type="A_type"/ >
Please see below for comments.
Evaluation returns false if DefaultVariable is null.
Evaluation checks for existence if no value is given. Otherwise compares the
property with the given name to the value with the specified operator.
<bundleState Id=“Some.Bundle.Id“
value=“ABundleStateForExampleActive”/>
<false/>
<bundleState Id=“Some.Bundle.Id“
value=“ABundleStateForExampleActive”/>
<false/>
Evaluation returns false
ObjectClass:
Evaluation returns false
ObjectClass:
<object classType="Empinia.Core.Runtime.IFakeFile" />
<object value="Empinia.Core.Runtime.IFakeFile" />
Tests if classType and the current Type represent the same type
Tests if classType and the current Type represent the same type
<instanceOf value="Empinia.Core.Runtime.IFakeFile"/>
Evaluation checks whether value type is in the inheritance hierarchy of the
default variable, or if the current Type is an interface that the default variable
supports
<variable name="FooVar"/>
Returns true if the default context contains a variable “FooVar”
<with variable="FooVar" operator="{and, or}" onEmpty="{true,
false}" / >
<iterate operator="{and, or}" onEmpty="{true, false}" ><another
term=""/></iterate>
Inherits IExpression[] Terms
Evaluation: foreach item in DefaultVariable Evaluate terms
<count value="{!, ?, +, *,\d, \d+, \d-}"/>
Possible CountModes:
Zero "!"; zero or one "?"; One or more "+";Any "*";Fixed or more postfix "+";Fixed
or less postfix "-"
Annotations
(Old) Object property expression
Depending on the combinations of attributes (or absence of them) the property tester shows
somewhat erratic behavior.
Attribute Meaning
Name
Name of the property to be tested. Mandatory.
The items combinations are tested in this order:
Value
Type
1. If the property on the tested object is null: return true if xml attribute “value” is
“null”. return false otherwise.
2. Xml value is not set, xml type is. Return true if type of the object value type equals the
xml type, false otherwise
3. Xml type not set, xml value is set AND is not “*”. Return true if object value equals
xml value, ignoring case.
4. Lastly, if the xml value is “*”, return true if the value is NOT an IEnumerable. If it is,
return true if the enumerable is NOT empty. If is IEnumerable but empty, return
false.
5. In any other case, return false.
Differences between old and new expressions





Regel #
1
1
2
2
3
3
4
4
4
Value to be compared against. Optional.
Value type to check. Optional.
XML “value”
“null”
X
XML “type” Object type
Null
Null
Foo
Foo
Foo
X
Foo, but not “*”
Foo
Foo, but not “*”
“*”
IEnumerable, empty
“*”
IEnumerable, nonempty
“*”
X
Note: Rule 1 already tests for “null-ness”
Result
True
False
True
False
True
False
False
True
True
5
False
Leer = Egal. „X“ = Irgendein beliebiger Wert. „Foo“ = Irgendein fester Wert.
Object property expressions behave noticeably different; especially regarding IEnumerables, but also in the tag format. ()
The check for nonempty IEnumerables would now be done with “count” expressions
“systemProperty” => “systemTest”
The “object” tag’s value attribute changed from “classType” to “value”
5 new expressions that (obviously) did not exist before
Download