Quintiq file version 2.0
|
#parent: #root
|
StaticMethod CompareNamedValue (LibUTF_IterationRun run, Boolean checkequals, NamedValue sourcenv,
|
NamedValue targetnv, String text)
|
{
|
Description: "Checks two NamedValue values if they match or not, based on the expected 'checkequals' value passed in."
|
TextBody:
|
[*
|
value := true;
|
|
sourcevalue := '';
|
targetvalue := '';
|
|
if( targetnv.GetValue().istype( Real ) )
|
{
|
value := sourcenv.GetValueAsReal() = targetnv.GetValueAsReal();
|
sourcevalue := [String]sourcenv.GetValueAsReal();
|
targetvalue := [String]targetnv.GetValueAsReal();
|
}
|
else if( targetnv.GetValue().istype( Number ) )
|
{
|
value := sourcenv.GetValueAsNumber() = targetnv.GetValueAsNumber();
|
sourcevalue := [String]sourcenv.GetValueAsNumber();
|
targetvalue := [String]targetnv.GetValueAsNumber();
|
}
|
else if( targetnv.GetValue().istype( String ) )
|
{
|
value := sourcenv.GetValueAsString() = targetnv.GetValueAsString();
|
sourcevalue := sourcenv.GetValueAsString();
|
targetvalue := targetnv.GetValueAsString();
|
}
|
else if( targetnv.GetValue().istype( Boolean ) )
|
{
|
value := sourcenv.GetValueAsBoolean() = targetnv.GetValueAsBoolean();
|
sourcevalue := [String]sourcenv.GetValueAsBoolean();
|
targetvalue := [String]targetnv.GetValueAsBoolean();
|
}
|
else if( targetnv.GetValue().istype( Date ) )
|
{
|
value := sourcenv.GetValueAsDate() = targetnv.GetValueAsDate();
|
sourcevalue := [String]sourcenv.GetValueAsDate();
|
targetvalue := [String]targetnv.GetValueAsDate();
|
}
|
else if( targetnv.GetValue().istype( DateTime ) )
|
{
|
value := sourcenv.GetValueAsDateTime() = targetnv.GetValueAsDateTime();
|
sourcevalue := [String]sourcenv.GetValueAsDateTime();
|
targetvalue := [String]targetnv.GetValueAsDateTime();
|
}
|
else if( targetnv.GetValue().istype( Duration ) )
|
{
|
value := sourcenv.GetValueAsDuration() = targetnv.GetValueAsDuration();
|
sourcevalue := [String]sourcenv.GetValueAsDuration();
|
targetvalue := [String]targetnv.GetValueAsDuration();
|
}
|
else if( targetnv.GetValue().istype( Key ) )
|
{
|
value := sourcenv.GetValueAsKey() = targetnv.GetValueAsKey();
|
sourcevalue := [String]sourcenv.GetValueAsKey();
|
targetvalue := [String]targetnv.GetValueAsKey();
|
}
|
else if( targetnv.GetValue().istype( BinaryValue ) )
|
{
|
value := sourcenv.GetValueAsBinaryValue() = targetnv.GetValueAsBinaryValue();
|
sourcevalue := [String]sourcenv.GetValueAsBinaryValue();
|
targetvalue := [String]targetnv.GetValueAsBinaryValue();
|
}
|
|
name := sourcenv.Name().SubString( 2, sourcenv.Name().Length() - 2 );
|
|
text := 'Checking matching value for (@NAME@). Expecting (@EXPECTED@) but is (@ACTUAL@).'
|
.ReplaceAll( '@NAME@', name )
|
.ReplaceAll( '@EXPECTED@', targetvalue )
|
.ReplaceAll( '@ACTUAL@', sourcevalue );
|
|
run.AssertEqual( value, checkequals, text );
|
*]
|
}
|