How to do it...

To create the unit test class, follow these steps:

  1. Create a new class and name it ConVMSVehicleGroupTest. 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 expect to either succeed or fail. In this case, we will have the following:
const ConVMSVehicleGroupId groupId = '%VG01%'; const str notFound = '%ERROR%'; 
The preceding strings are written as such to ensure that they don't interfere with existing records, which is possible if we instruct the test to use company data. By default, a special data partition is used for all data operations, which is removed once the test completes.
  1. The next part is to set up the test ...

Get Extending Microsoft Dynamics 365 Finance and Supply Chain Management Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.