Forum Discussion

bill's avatar
bill
Occasional Contributor
11 years ago

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 Groupin...
  • HKosova's avatar
    11 years ago
    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");