Building ERP Solutions with Microsoft Dynamics NAV
上QQ阅读APP看书,第一时间看更新

Testing the application

In order to test the application for the two described scenarios (orders retrieval and order creation), our console application must receive the correct defined parameter (READ, CREATE) at startup.

Let's learn how to test the application by performing the following steps:

  1. To do so, right-click on the solution name, click Properties, and then choose Debug. In the Debug window, you can specify the startup parameters:
  2. Let's test the application by passing the READ parameter as input.
  3. The application code has to retrieve all the sales orders for Customer No. = 10000 (Cannon Group SpA) and this is the situation that we have on NAV:
  4. If you place a breakpoint (by pressing F9) after the lines that calls the NAV web service, you can see the retrieved records in the Debug window:
  5. The final output on the console shows you the details for all the retrieved sales orders:
  6. Now change the application startup parameter and use CREATE in order to call the function for creating a sales order on NAV:
  7. We placed a breakpoint after the first NAV web service Create call to check the correct order initialization (NAV must give us the Order No.). While debugging (Visual Studio stops the execution at your breakpoint) select the order object on the code, right-click, and choose QuickWatch….
  8. In the QuickWatch window in Visual Studio, you can see all the object details and you can check the Order No. returned by NAV:
  9. This is the final result on NAV: