TestService Class

Contains methods for configuring and determining current configuration of Accounting Seed in a testing context. The purpose of this class is to facilitate writing unit tests for integrations to Accounting Seed.

Note: This class and methods can only be used in a test context.

TestService Methods

The following are methods for TestService. All methods are static.


disableAutoPostSourceDocuments()

Disables auto posting for certain source documents in testing context. The Cash Receipt, Billing Cash Receipt, AP Disbursement, and Amortization Entry Accounting Seed objects can be configured to auto post when created.
If Orders and Inventory is installed the Sales Order Inventory Movement, Purchase Order Inventory Movement, Manufacturing Inventory Movement, Inbound Inventory Movement and the Outbound Inventory Movement custom objects auto post when created. Auto posting is enabled by default.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.disableAutoPostSourceDocuments();



enableAutoPostSourceDocuments()

Enables auto posting for certain source documents in a testing context. The Cash Receipt, Billing Cash Receipt, AP Disbursement, and Amortization Entry Accounting Seed objects can be configured to auto post when created.
If Orders and Inventory is installed the Sales Order Inventory Movement, Purchase Order Inventory Movement, Manufacturing Inventory Movement, Inbound Inventory Movement and the Outbound Inventory Movement custom objects auto post when created. Auto posting is enabled by default.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.enableAutoPostSourceDocuments();



enableAvalaraVATReporting()

Enables functionality associated with the Accounting Seed Avalara VAT Reporting integration extension package in a testing context. This method should only be used if the Accounting Seed Avalara VAT Reporting integration extension package is installed.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.enableAvalaraVATReporting();



enableMultiCurrency()

Enables Accounting Seed multicurrency functionality in a testing context. The org must have Salesforce advanced multicurrency enabled and configured to use this method.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.enableMultiCurrency();



getInventoryValuation()

Returns the inventory valuation method used by Accounting Seed to calculate cost of goods sold in a testing context. The supported inventory valuation methods are standard cost and average cost.
Inventory valuation is supported only if the Accounting Seed Orders and Inventory extension package is installed.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.getInventoryValuation();



getLedgerLimit()

Returns the number of allowed transactional ledgers in a testing context.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.getLedgerLimit();



isAvalaraVATReportingEnabled()

Returns whether Accounting Seed Avalara VAT Reporting has been enabled in a testing context.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.isAvalaraVATReportingEnabled();



setLedgerLimit(Integer newLedgerLimit)

Sets the number of transactional ledgers allowed in the application in a testing context.

Parameters

ledgerId
Type: Integer
The number of transactional ledgers allowable in the application.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.setLedgerLimit(10);



getOrgDefaultLedgerId()

Returns the default organization ledger Id in a testing context. The default organization ledger is the ledger used when users create source document records i.e. Billing, Payable, Journal Entry, etc. The default ledger can be set on a user by user basis by setting a user active ledger using the setUserActiveLedgerId(Id ledgerId) method.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.getOrgDefaultLedgerId();



setOrgDefaultLedgerId(Id ledgerId)

Sets the default organization ledger Id in a testing context. The default organization ledger is the ledger used when users create source document records i.e. Billing, Payable, Journal Entry, etc. The default ledger can be set on a user by user basis by setting a user active ledger using the setUserActiveLedgerId(Id ledgerId) method.

Parameters

ledgerId
Type: Id
The Id of the ledger to set as the default organization ledger.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.setOrgDefaultLedgerId();



getTestData()

Returns setup data in a testing context. This includes Accounting Periods, GL Accounts, Accounting Settings, and Ledgers. This is the base data needed to facilitate implementing unit tests in Accounting Seed.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.setupTestData();



setupTestData()

Configures setup data in a testing context. This includes Accounting Period, GL Account, Accounting Settings, and Ledger records. This is the base data needed to facilitate implementing unit tests in Accounting Seed.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.getTestData();



getUserActiveLedgerId()

Get the active ledger for the current user in a testing context. The active ledger is the default ledger used when users create source document records i.e. Billing, Payable, Journal Entry, etc.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.getUserActiveLedgerId();



setUserActiveLedgerId(Id ledgerId)

Set the active ledger for the current user in a testing context. The active ledger is the default ledger used when users create source document records i.e. Billing, Payable, Journal Entry, etc.

Parameters

ledgerId
Type: Id
The Id of the ledger to set as the default for the active user.

Return Value
Type: ServiceResult

Usage

Id ledgerId = [SELECT Id FROM AcctSeed__Ledger__c WHERE Name = 'Actual' LIMIT 1].Id;
AcctSeed.ServiceResult sr = AcctSeed.TestService.setUserActiveLedgerId(ledgerId);



getUserActiveLedgerId()

Get the active ledger for the current user in a testing context. The active ledger is the default ledger used when users create source document records i.e. Billing, Payable, Journal Entry, etc.

Return Value
Type: ServiceResult

Usage

AcctSeed.ServiceResult sr = AcctSeed.TestService.getUserActiveLedgerId();