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.
- Mock pricing data accessor with XML. If you remember, we have IPricingDataAccessor to bridge the difference between AX and channel data access.
- Automatic validation of data integrity.
- 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
- Test configurations: concurrency control model, compound behavior, and hold-or-split-for-rounding, etc.
- AddPriceGroupToTransaction and AddPriceGroupsToTransaction: this sets up the (mock) discounts for the discount calculation.
Default mock implementation of ITransactionSetupAndDataManager
Data integration verification
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.
Test Foundation Core Data