Book Image

Microsoft Dynamics AX 2012 R3 Reporting Cookbook Update

Book Image

Microsoft Dynamics AX 2012 R3 Reporting Cookbook Update

Overview of this book

Table of Contents (17 chapters)
Microsoft Dynamics AX 2012 R3 Reporting Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a unit test class for a controller class


In the previous recipe, you learned how to write a unit test class for a contract class. In this recipe, you will learn how to create unit test classes for a controller class. A controller class is used for report execution as well as processing of report data. For the unit test class, first we will create a new controller class and then test the business logic inside that controller class in AX R3.

Getting ready

To work with this recipe, we need to create a controller class named PKTVendInvoiceController that extends SRSReportRunController.

How to do it...

  1. The first step is to add a PKTVendInvoiceController class which extends SRSReportRunController:

    public class PKTVendInvoiceController extends SrsReportRunController
    {
    }
    public void execute(Args _args)
    {
        this.parmReportName(ssrsReportStr(PKTVendInvoice, Report));
        this.parmArgs(_args);
        this.startOperation();
    }
    
    public static PKTVendInvoiceController construct()
    {
        return new PKTVendInvoiceController...