Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ codeunit 139605 "Shpfy Product Price Calc. Test"
InitializeTest: Codeunit "Shpfy Initialize Test";
ProductInitTest: Codeunit "Shpfy Product Init Test";
ProductPriceCalculation: Codeunit "Shpfy Product Price Calc.";
PriceCalcMgt: Codeunit "Price Calculation Mgt.";
InitUnitCost: Decimal;
InitPrice: Decimal;
InitDiscountPerc: Decimal;
Expand All @@ -45,6 +46,8 @@ codeunit 139605 "Shpfy Product Price Calc. Test"
begin
// [INIT] Initialization startup data.
LibraryPriceCalculation.DisableExtendedPriceCalculation();
// PROBE 1: confirm what IsExtendedPriceCalculationEnabled returns in this env
LibraryAssert.AreEqual(false, PriceCalcMgt.IsExtendedPriceCalculationEnabled(), 'PROBE_1_IsExtendedShouldBeFalseAfterDisable');
Shop := InitializeTest.CreateShop();
Shop."Allow Line Disc." := false;
Shop.Modify();
Expand Down Expand Up @@ -80,6 +83,10 @@ codeunit 139605 "Shpfy Product Price Calc. Test"
ProductPriceCalculation.CalcPrice(Item, '', '', UnitCost, Price, ComparePrice);
// [THEN] InitUnitCost = UnitCost
LibraryAssert.AreEqual(InitUnitCost, UnitCost, 'Unit Cost');
// PROBE 2: confirm what IsExtended returns AFTER setting up discount group
LibraryAssert.AreEqual(false, PriceCalcMgt.IsExtendedPriceCalculationEnabled(), 'PROBE_2_IsExtendedShouldStillBeFalse');
// PROBE 3: dump Price/ComparePrice values into the failure message so we can see them
LibraryAssert.AreNotEqual(InitPrice, Price, StrSubstNo('PROBE_3_DiscountApplied? Price=%1 InitPrice=%2 ComparePrice=%3 InitDiscountPerc=%4', Price, InitPrice, ComparePrice, InitDiscountPerc));
// [THEN] InitPrice = ComparePrice. ComparePrice is the price without the discount.
LibraryAssert.AreEqual(InitPrice, ComparePrice, 'Compare Price');
// [THEN] InitPrice - InitDiscountPerc = Price
Expand Down
Loading