Dynamics Retail Discount Extensibility - Test Foundation

Creating a new discount type is a complex task as we really need to understand how discount works functionally. Assuming we have just created a new discount type, how do we test it out? We can always deploy it to Dynamics Lifecycle Services sandbox and test it out there. I have tried it myself a few times. It is a great experience for me, but it would be beyond time-consuming for daily development.

Introduce the test foundation for Dynamics retail pricing engine.

It is under private review. If you need it now, ping me or your Dynamics retail extensibility team contact.

In short, you can run component level unit test in your SDK.

  1. Mock pricing data accessor with XML. If you remember, we have IPricingDataAccessor to bridge the difference between AX and channel data access.
  2. Automatic validation of data integrity.
  3. Miscellaneous utilities.

Now, technical details.

It is more of a reference below. You may skip to sample test post.

Test data interface ITransactionSetupAndDataManager

It inherits from pricing engine data accessor: IPricingDataAccessor. In addition, it helps with test data setup

  1. Test configurations: concurrency control model, compound behavior, and hold-or-split-for-rounding, etc.
  2. AddPriceGroupToTransaction and AddPriceGroupsToTransaction: this sets up the (mock) discounts for the discount calculation.

Default mock implementation of ITransactionSetupAndDataManager

TestFoundationPricingDataManager

Data integration verification

SalesTransactionVerification

Mock (main) discount data types.

PeriodicDisocuntData and PeriodicDiscountLineData. You need to know them if you want to extend them to support your new discount types.

Helpers

TestFoundationCommonData

TestFoundationPriceContextHelper

TestFoundationPricingHelper

TestFoundationSalesTransactionHelper

Test Foundation Core Data

Under RetailSdk\Documents\SampleExtensionsInstructions\PricingAndDiscounts\TestFoundationData

Related: Dynamics Retail Discount Extensibility - Main picture

Related: Dynamics Retail Discount Extensibility - Sample Test