How to do it...

To create the unit test class, follow these steps:

  1. Create a new class and name it ConWHSVehicleGroupChangeTest. The suffix is important.
  2. In the code editor, change the declaration so that it extends SysTestCase.
  3. Next, we will need some constants for test cases that we either expect to succeed or fail; in this case, we will have the following:
const ConWHSVehicleGroupId groupId= '%VG01%'; const ConWHSVehicleId vehicleId  ='%V001%'; const str notFound= '%ERROR%'; 
  1. The next part is to set up the test case, which is done by overriding the setUpTestCase method with the following code:
publicvoidsetUpTestCase() {   super();   ConWHSVehicleGroupvehGroup;   ttsbegin;   vehGroup.initValue();   vehGroup.VehicleGroupId = groupId;  vehGroup.insert(); ...

Get Extending Microsoft Dynamics 365 for Operations Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.