I want to create a script using TestComplete to test a C# API one of my colleagues wrote. How would I go about creating a C# list with TestComplete since it requires all arguments to be passed to a C# function, even though all arguments have a default value. I am using the CLR Bridge to load the DLL for the API. I want to use dotNET in order to call these functions.
// Here are two C# functions I want to call:
1) public short SendRequest(List<IP> ipList, double timeout = 2.0)
2) public void RefreshWindow(List<Devices> deviceList = null, int maxAttempts = 3, double timeout=2.0)
// So Far all I got to work is this but that just creates a list of 'Sytem.Object' not a list of the class I want.
var typeListOf = dotNET.System.Type.GetType("System.Collections.Generic.List`1");
var paramTypes = dotNET.System.Array.CreateInstance(dotNET.System.Type.GetType("System.Type"), 1);
var objType = dotNET.System.Type.GetType("System.Object"); paramTypes.SetValue(objType, 0); var typeListOfString = typeListOf.MakeGenericType(paramTypes); var list = dotNET.System.Activator.CreateInstance_3(typeListOfString);
Regards, /Alex [Community Hero] ____ [Community Heroes] are not employed by SmartBear Software but are just volunteers who have some experience with the tools by SmartBear Software and a desire to help others. Posts made by [Community Heroes] may differ from the official policies of SmartBear Software and should be treated as the own private opinion of their authors and under no circumstances as an official answer from SmartBear Software. The [Community Hero] signature is used with permission by SmartBear Software. https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame ================================