Skip to content

Commit fd77a4c

Browse files
committed
Fixing disabled tests
1 parent d5275bf commit fd77a4c

14 files changed

Lines changed: 83 additions & 217 deletions

src/Apps/W1/Subscription Billing/Test/Billing/AutomatedBillingTest.Codeunit.al

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ codeunit 148455 "Automated Billing Test"
7777
var
7878
CustomerSubscriptionContract: Record "Customer Subscription Contract";
7979
SubscriptionHeader: Record "Subscription Header";
80+
SubscriptionLine: Record "Subscription Line";
8081
BillingTemplate: Record "Billing Template";
8182
BillingLine: Record "Billing Line";
8283
SalesHeader: Record "Sales Header";
@@ -87,8 +88,16 @@ codeunit 148455 "Automated Billing Test"
8788
// [GIVEN] A Billing Template with automation settings
8889
CreateBillingTemplateWithAutomation(BillingTemplate);
8990

90-
// [WHEN] Bill the contracts automatically
91+
// [GIVEN] A contract with subscription lines starting today
9192
ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerSubscriptionContract, SubscriptionHeader, '');
93+
SubscriptionLine.SetRange("Subscription Header No.", SubscriptionHeader."No.");
94+
SubscriptionLine.FindSet();
95+
repeat
96+
SubscriptionLine.Validate("Subscription Line Start Date", Today());
97+
SubscriptionLine.Modify(true);
98+
until SubscriptionLine.Next() = 0;
99+
100+
// [WHEN] Bill the contracts automatically
92101
BillingTemplate.BillContractsAutomatically();
93102

94103
// [THEN] Verify that Sales Header is created for the billed contract
@@ -118,8 +127,15 @@ codeunit 148455 "Automated Billing Test"
118127
CreateBillingTemplateWithAutomation(BillingTemplate);
119128
ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerSubscriptionContract, SubscriptionHeader, '');
120129

121-
// [GIVEN]Remove Item UOM to cause error during billing
130+
// [GIVEN] Subscription lines starting today
122131
SubscriptionLine.SetRange("Subscription Header No.", SubscriptionHeader."No.");
132+
SubscriptionLine.FindSet();
133+
repeat
134+
SubscriptionLine.Validate("Subscription Line Start Date", Today());
135+
SubscriptionLine.Modify(true);
136+
until SubscriptionLine.Next() = 0;
137+
138+
// [GIVEN] Remove Item UOM to cause error during billing
123139
SubscriptionLine.FindLast();
124140
ItemUnitOfMeasure.Get(SubscriptionLine."Invoicing Item No.", SubscriptionHeader."Unit of Measure");
125141
ItemUnitOfMeasure.Delete();

src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingDocsTest.Codeunit.al

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ codeunit 139687 "Recurring Billing Docs Test"
12941294
end;
12951295

12961296
[Test]
1297-
[HandlerFunctions('MessageHandler,GetVendorContractLinesProducesCorrectAmountsDuringSelectionPageHandler,ExchangeRateSelectionModalPageHandler')]
1297+
[HandlerFunctions('GetVendorContractLinesProducesCorrectAmountsDuringSelectionPageHandler')]
12981298
procedure GetVendorContractLinesProducesCorrectAmountsDuringSelection()
12991299
var
13001300
Item: Record Item;
@@ -1306,7 +1306,7 @@ codeunit 139687 "Recurring Billing Docs Test"
13061306
// [GIVEN] Setup Subscription with Subscription Line and assign it to Vendor Subscription Contract
13071307
// [GIVEN] Create Purchase Invoice with Purchase Invoice Line
13081308
ContractTestLibrary.DeleteAllContractRecords();
1309-
ContractTestLibrary.CreateVendor(Vendor);
1309+
ContractTestLibrary.CreateVendorInLCY(Vendor);
13101310
ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No.");
13111311
GetVendorContractServiceCommitment(VendorContract."No.");
13121312
ServiceCommitment."Billing Rhythm" := ServiceCommitment."Billing Base Period";

src/Apps/W1/Subscription Billing/Test/Billing/RecurringBillingTest.Codeunit.al

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,6 @@ codeunit 139688 "Recurring Billing Test"
601601
end;
602602

603603
[Test]
604-
[HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')]
605604
procedure CheckBillingLineUpdateRequiredOnModifyCustomerContractLine()
606605
var
607606
DiscountAmount: Decimal;
@@ -611,7 +610,7 @@ codeunit 139688 "Recurring Billing Test"
611610
begin
612611
Initialize();
613612

614-
ContractTestLibrary.CreateCustomer(Customer);
613+
ContractTestLibrary.CreateCustomerInLCY(Customer);
615614
ContractTestLibrary.CreateCustomerContractAndCreateContractLinesForItems(CustomerContract, ServiceObject, Customer."No.");
616615
ContractTestLibrary.CreateBillingProposal(BillingTemplate, Enum::"Service Partner"::Customer);
617616
BillingLine.Reset();
@@ -656,7 +655,6 @@ codeunit 139688 "Recurring Billing Test"
656655
end;
657656

658657
[Test]
659-
[HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')]
660658
procedure CheckBillingLineUpdateRequiredOnModifyVendorContractLine()
661659
var
662660
DiscountAmount: Decimal;
@@ -666,7 +664,7 @@ codeunit 139688 "Recurring Billing Test"
666664
begin
667665
Initialize();
668666

669-
ContractTestLibrary.CreateVendor(Vendor);
667+
ContractTestLibrary.CreateVendorInLCY(Vendor);
670668
ContractTestLibrary.CreateVendorContractAndCreateContractLinesForItems(VendorContract, ServiceObject, Vendor."No.");
671669
ContractTestLibrary.CreateBillingProposal(BillingTemplate, Enum::"Service Partner"::Vendor);
672670
BillingLine.Reset();

src/Apps/W1/Subscription Billing/Test/Contract Renewal/ContractRenewalTest.Codeunit.al

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,8 @@ codeunit 139692 "Contract Renewal Test"
674674
Initialize();
675675
// [GIVEN] We Create all the needed data
676676
CreateBaseData();
677+
CustomerContract.Validate("Currency Code", '');
678+
CustomerContract.Modify(false);
677679
BaseCalculationPercentage := LibraryRandom.RandDecInDecimalRange(80, 100, 2);
678680
CalculationBaseAmount := LibraryRandom.RandDecInDecimalRange(80, 100, 2);
679681
// [WHEN] We run the action Contract Renewal Quote and change the values on Subscription, values are tested in a ContractRenewalSelectionModalPageHandler

0 commit comments

Comments
 (0)