11-09-2018 05:00 AM - edited 11-09-2018 05:03 AM
HI,
Lets consider there are 3 classes as A,B,C. Class A is parent of Class B and C. I'll be read a class object from file using "Get LV class default value.vi" using Class B API.
I just need to check whether that read object is object of same class or its parent class i.e., It can be either class B or Class A.
How can I test it?
Solved! Go to Solution.
11-09-2018 05:15 AM
Use To More Specific Class to try to cast the object to Class A and/or Class B. You will get an error if it can't.
11-09-2018 05:32 AM
Test Condition: Class Path specified in file should be
1) either Class A or B,
2) It should not be Class C.
Let say, The input object is Class B and typecast to Class B, then there will not be any error. But if input path is class A, it will throw the error.
If I'm using to more generic property for casting input object to Class A, the condition (i) pass but condition two fails.
11-09-2018 06:22 AM
The only other solution I am coming up with is to use the Get LV Class Name VI to get a string of the object's class name and do a comparison to what you expect it to be (have an array of allowed classes and use Search 1D Array, the index will be negative if the name is not found).