bill
11 years agoOccasional Contributor
Creating .Net enumerations from Test Complete?
Maybe I'm just overthinking this, but I didn't see any documentation about how to create an enumeration type to pass to a .Net method.
I'm trying to call a method on the Syncfusion Grid Grouping Control via something like this:
var net = Process("Blah").AppDomain("Blah.exe").dotNET;
var enumType =
net.Syncfusion_Windows_Forms_Grid_GridRangeOptions.GetType();
var rangeInfoOptions = net.System_Enum.Parse(
enumType,
"MergeCoveredCells,MergeFloatedCells");
However, I recieve the dreaded "'Syncfusion_Windows_Forms_Grid_GridRangeOptions' is null or not an object" error from Test Complete.
I could use the global dotNET object with the CLR Bridge option but I'm not sure what that means about having to have the necessary assembly around at run time.
(and the assembly version in CLR bridge might not match the version the app domain is using) :(
I'm sure I'm forgetting something unbelievably silly, but thanks a bunch if you have any suggestions for this issue.
Thanks again,
Bill
I'm trying to call a method on the Syncfusion Grid Grouping Control via something like this:
var net = Process("Blah").AppDomain("Blah.exe").dotNET;
var enumType =
net.Syncfusion_Windows_Forms_Grid_GridRangeOptions.GetType();
var rangeInfoOptions = net.System_Enum.Parse(
enumType,
"MergeCoveredCells,MergeFloatedCells");
However, I recieve the dreaded "'Syncfusion_Windows_Forms_Grid_GridRangeOptions' is null or not an object" error from Test Complete.
I could use the global dotNET object with the CLR Bridge option but I'm not sure what that means about having to have the necessary assembly around at run time.
(and the assembly version in CLR bridge might not match the version the app domain is using) :(
I'm sure I'm forgetting something unbelievably silly, but thanks a bunch if you have any suggestions for this issue.
Thanks again,
Bill
- Hi Bill,
First, change:
Syncfusion_Windows_Forms_Grid_GridRangeOptions => Syncfusion_Windows_Forms_Grid.GridRangeOptions
System_Enum => System.Enum
Note the period before the class name. The syntax is:namespace_with_underscores.class
For example:
Namespace: Syncfusion.Windows.Forms.Grid
Class: GridRangeOptions
TestComplete syntax: dotNET.Syncfusion_Windows_Forms_Grid.GridRangeOptions
When in doubt, check Code Completion.
I don't have your assembly to check, but this works for a built-in .NET enum:var enumType = dotNET.System_IO.FileOptions.Asynchronous.GetType();
var options = dotNET.System.Enum.Parse(enumType, "Asynchronous,DeleteOnClose");
Log.Message(options);
So in your case, it should be something like this:var net = Process("Blah").AppDomain("Blah.exe").dotNET;
var enumType = net.Syncfusion_Windows_Forms_Grid.GridRangeOptions.MergeCoveredCells.GetType();
var rangeInfoOptions = net.System.Enum.Parse(enumType, "MergeCoveredCells,MergeFloatedCells");