Creating unit tests with data isolation

In this instance, our test case will create data that will used to test that the records are inserted correctly and the methods perform the correct behavior.

The test will be to create a number of vehicle service records and test the validateField, modifiedField, and insert methods. We also want to test creating a number of these records to test performance of this table.

The steps involved in this scenario are the same as before, except that we need to tear down the data we created. We will also see that a test case can actually contain far more code than the code that we are testing. This is normal, and we expect to see a 3:1 ratio of test code to business logic.

The framework supports automatic teardown ...

Get Mastering Microsoft Dynamics AX 2012 R3 Programming now with O’Reilly online learning.

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