There is a pageextension that changes the “Document Date” to WorkDate() when the page opens. It is working fine - using trigger OnOpenPage().
I’d like to write a test for that:
procedure IsSalesInvoiceDocumentDateWorkday() var SalesHeader: Record "Sales Header" temporary; SalesInvoice: TestPage "Sales Invoice"; begin //Create a dummy record with a document date that is different than the WORKDATE SalesHeader.Init(); SalesHeader.Insert(true); SalesHeader."Document Date" := CalcDate('<1D>', WorkDate()); SalesHeader.Modify(); SalesInvoice.OpenEdit(); SalesInvoice.F_DocumentDate.AssertEquals(WorkDate());
I can see that it is a problem which record the “Sales Invoice” will open. But still I am not sure that the pageextension’s modification runs with this SalesInvoice.OpenEdit() line.
How can I write a test for this?