Share via


Dynamics Retail Discount Extensibility - Sample Test

Update - this blog post has been moved to Dynamics 365 Community. It is under private review. If you need it now, ping me or your Dynamics retail extensibility team contact.

We build sample test (Runtime.Extensions.PricingEngineSample.Tests in sample SDK) on top on the Dynamics retail pricing engine test foundation.

Mock your new discount type

  1. (Folder TestDataManager) Extends PeriodicDisocuntData and PeriodicDiscountLineData from test foundation. See ExtensionDiscountData and ExtensionDiscountLineData.
  2. (Folder TestDataManager\SampleData) Add xml file for your discount data. See DiscountOffersAmountCap.xml or DiscountOffersLineFilter.xml. If a price group is associated with a non-zero priority, add it to ExtensionPriceGroups.xml
  3. (Folder TestDataManager) PricingSampleRepository: read extension discount data from xml
  4. (Folder TestDataManager) GlobalTestSampleDataCache: your sample data global cache.
  5. (Folder TestDataManager) ExtensionTestPricingDataManager. You can override ReadRetailDiscounts and GetRetailDiscountPriceGroups. In addition, it needs to support your own extension data access interface.

Now you can have fun with your new discount type and your tests.

All tests need to inherit from PricingBaseFunctionalTests.

Test Foundation Core Data

Under RetailSdk\Documents\SampleExtensionsInstructions\PricingAndDiscounts\TestFoundationData

Related: Dynamics Retail Discount Extensibility - Test Foundation

Related: Dynamics Retail Discount Extensibility - Main picture