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

Unit testing business logic


Debugging can be a time-consuming task as it is required to re-deploy the reports for every change that is made. An alternate way to reduce this cycle and make it easier to test is by creating unit test cases. Visual Studio has handy tools that can create a unit testing project. This recipe will implement unit testing for the drill-through action implemented in the Adding a URL drill through action in reports recipe.

How to do it…

  1. Select the DrillVoucher method in the business logic class. Right-click and select Create Unit Tests.

  2. A Create Unit Tests dialog will appear with the DrillVoucher method selected by default. If additional methods are present, check them and click on OK.

    This will create a unit test project and a specific implementation to invoke the DrillVoucher method like this:

    [TestMethod()]
            public void DrillVoucherTest()
            {
                string reportContext = "?RunOnClient=1&PrintMediumType=Screen"
                string VoucherNum = "ARPM000004...