@@ -21,7 +21,7 @@ public void SetUp()
2121 [ TestCase ( "var2" , "var1" , 3 ) ]
2222 [ TestCase ( "var2.var3" , "var1" , "TestValue" ) ]
2323 [ TestCase ( "var2.var2.var2" , "var1" , true ) ]
24- public void TestExtractionPass ( string propertyPath , string source , object expected )
24+ public void TestFieldsExtractionPass ( string propertyPath , string source , object expected )
2525 {
2626 var property = scriptableObject . FindProperty ( propertyPath ) ;
2727 var sibling = property . GetSibling ( source ) ;
@@ -31,5 +31,31 @@ public void TestExtractionPass(string propertyPath, string source, object expect
3131 Assert . IsFalse ( hasMixedValues ) ;
3232 Assert . AreEqual ( expected , actual ) ;
3333 }
34+
35+ [ TestCase ( "var2" , "BoolValue" , true ) ]
36+ [ TestCase ( "var2.var3" , "GetFloatValue" , 1.6f ) ]
37+ [ TestCase ( "var2.var2.var2" , "IntValue" , 3 ) ]
38+ public void TestPropertiesExtractionPass ( string propertyPath , string source , object expected )
39+ {
40+ var property = scriptableObject . FindProperty ( propertyPath ) ;
41+ ValueExtractionHelper . TryGetValue ( source , property , out var actual , out _ ) ;
42+ Assert . AreEqual ( expected , actual ) ;
43+ }
44+
45+ [ TestCase ( "var2" , "GetStringValue" , "Text" , true ) ]
46+ [ TestCase ( "var2" , "GetDoubleValue" , null , false ) ]
47+ [ TestCase ( "var2.var3" , "GetFloatValue" , 1.6f , true ) ]
48+ [ TestCase ( "var2.var2.var2" , "GetIntValue" , null , false ) ]
49+ [ TestCase ( "var2.var2.var2" , "DoSomething" , null , true ) ]
50+ public void TestMethodsExtractionPass ( string propertyPath , string source , object expected , bool success )
51+ {
52+ var property = scriptableObject . FindProperty ( propertyPath ) ;
53+ var isFound = ValueExtractionHelper . TryGetValue ( source , property , out var actual , out _ ) ;
54+ Assert . AreEqual ( success , isFound ) ;
55+ if ( isFound )
56+ {
57+ Assert . AreEqual ( expected , actual ) ;
58+ }
59+ }
3460 }
3561}
0 commit comments