I am writing a unit test and need to programmatically click a button in an UltraGrid I've created. I cannot seem to find a method to do this. For a standard Windows control there is a PerformClick() method but I can't find the equivalent for the button in my UltraGrid. I am using a MVP design so my presenter subscribes to the ClickCellButton event so I'd like to programmatically click the cell button for a given row and trigger the code in my presenter. Thanks!
Hello Thomas,
Thank you for contacting Infragistics. Please clarify that you want to call PerformClick in a test, not in a live application the user is working with?
How are you adding buttons to your grid cells? If they are embedded UltraButtons or Microsoft Buttons they both should expose a PerformClick that you should be able to fire directly. The grid does not expose this method if the column's ColumnStyle property is set to Button since these are not controls.
If the application is finished and your testing it, you might want to consider using our Test Advantage software, as it records and plays back clicks for you automatically; better suited for a job that needs to mimic user input.
Let me know if you have any questions.
Michael,
I am using XUnit to perform automated unit testing.
I am using the ColumnStyle property set to Button for my UltraGrid. Each row in the UltraGrid has a column with the ColumnStyle property set to Button. I've subscribed to the ClickCellButton event for the UltaGrid to perfrom the operation I want. The operating uses the Cell.Row.Delete function of the CellEventArg passed to the function. I'm trying to write a unit test that verifies that fires correctly and that the datagrid contents are what I expect them to be after the deletion. I don't know how to fire the ClickCellButton event programmatically.
Thank you for clarifying, there is no perform method to handle the click for a cell programmatically. We also don't support XUnit to perform automated testing. Unless there is a way to record the click for playback; Test Advantage is our proprietary testing software that integrates with UFT from MicroFocus.
We're currently using XUnit for testing so I will explore adding a Micosoft button to the UltraGrid or some other solution. Thank you for your help!