private void Test_CreateLedgerRecords_Account_Record_Creation_Base(string accountType, string finPeriodID, decimal accountYtdBalance, decimal expectedBeginBalance, decimal?ptdDebit = null, decimal?ptdCredit = null)
        {
            //Arrange
            SetupAccountsWithGLHistory(accountYtdBalance, finPeriodID, accountType, ptdDebit, ptdCredit);

            GAFRepositoryMock.Setup(repo => repo.GetPostedGLTrans(_branchDataContext.Branch.BranchID,
                                                                  _branchDataContext.Branch.LedgerID,
                                                                  _accountDataContext.AssetAccount.AccountID,
                                                                  _finPeriodDataContext.FinPeriod201503.FinPeriodID))
            .Returns(new GLTran[] {});

            //Action
            var ledgerRecord = _glgafLedgerRecordsCreator.CreateLedgerRecords(_gafPeriodDataContext.GAFPeriod)
                               .Single();

            //Assert
            Assert.Equal(_accountDataContext.AssetAccount.AccountCD, ledgerRecord.AccountID);
            Assert.Equal(_accountDataContext.AssetAccount.Description, ledgerRecord.AccountName);
            Assert.Equal("OPENING BALANCE", ledgerRecord.TransactionDescription);
            Assert.Equal(_finPeriodDataContext.FinPeriod201503.StartDate, ledgerRecord.TransactionDate);
            Assert.Equal(0, ledgerRecord.DebitAmount);
            Assert.Equal(0, ledgerRecord.CreditAmount);
            Assert.Equal(expectedBeginBalance, ledgerRecord.BalanceAmount);

            Assert.Null(ledgerRecord.Name);
            Assert.Null(ledgerRecord.TransactionID);
            Assert.Null(ledgerRecord.SourceDocumentID);
            Assert.Null(ledgerRecord.SourceType);
        }
        public void Test_CreateGAFRecordsForDocumentGroup_For_Documents_With_Two_Taxes_And_Custom_LineNumbers()
        {
            //Arrange
            Action setup = delegate()
            {
                var soInvoices = new[]
                {
                    new SOInvoice()
                    {
                        DocType       = ARDocType.Invoice,
                        RefNbr        = DocumentDataContext.RefNbr,
                        ShipAddressID = _soAddressDataContext.CustomerAddress.AddressID
                    },
                    new SOInvoice()
                    {
                        DocType       = ARDocType.Invoice,
                        RefNbr        = DocumentDataContext.RefNbr2,
                        ShipAddressID = _soAddressDataContext.Customer2Address.AddressID
                    }
                };

                GAFRepositoryMock.Setup(
                    repo => repo.GetSOInvoices(It.IsAny <string>(), It.IsAny <string[]>()))
                .Returns <string, string[]>((docType, refNbrs) => soInvoices.Where(soInvoice => soInvoice.DocType == docType &&
                                                                                   refNbrs.Contains(soInvoice.RefNbr)));
            };

            Test_CreateGAFRecordsForDocumentGroup_For_Documents_With_Two_Tax_And_Custom_LineNumbers(BatchModule.SO, setup);
        }
Beispiel #3
0
        protected void SetupRepositoryMethods(ICollection <APRegisterAggregate> paymentAggregs, ICollection <APRegister> adjdDocumentRegisters, string module, string docType,
                                              int?taxAgencyID, string taxPeriodID)
        {
            var taxTrans =
                paymentAggregs.SelectMany(
                    apInvoiceAggr =>
                    apInvoiceAggr.TaxTransByTax.Values.SelectMany(taxTranList => taxTranList.Select(taxTran => taxTran)));

            GAFRepositoryMock.Setup(repo => repo.GetReportedTaxTransForDocuments(module,
                                                                                 docType,
                                                                                 It.Is <string[]>(refNbrs => refNbrs.SequenceEqual(paymentAggregs.Select(aggr => aggr.Document.RefNbr))),
                                                                                 taxAgencyID,
                                                                                 taxPeriodID))
            .Returns(taxTrans);

            var taxTransWithAdjdDocument =
                paymentAggregs.SelectMany(
                    aggr => aggr.TaxTransByTax.Values.SelectMany(taxTranList => taxTranList.Select(
                                                                     taxTran => new PXResult <TaxTran, APRegister>(taxTran,
                                                                                                                   adjdDocumentRegisters.Single(
                                                                                                                       register => register.DocType == taxTran.AdjdDocType && register.RefNbr == taxTran.AdjdRefNbr)))));

            GAFRepositoryMock.Setup(repo => repo.GetReportedTaxTransWithAdjdDocumentForAPPayments(docType,
                                                                                                  It.Is <string[]>(refNbrs => refNbrs.SequenceEqual(paymentAggregs.Select(aggr => aggr.Document.RefNbr))),
                                                                                                  taxAgencyID,
                                                                                                  taxPeriodID))
            .Returns(taxTransWithAdjdDocument);
        }
        public GLGAFLedgerRecordsCreatorTests()
        {
            _accountDataContext   = GetService <AccountDataContext>();
            _gafPeriodDataContext = GetService <GAFPeriodDataContext>();
            _taxPeriodDataContext = GetService <TaxPeriodDataContext>();
            _branchDataContext    = GetService <BranchDataContext>();
            _finPeriodDataContext = GetService <FinPeriodDataContext>();

            _glgafLedgerRecordsCreator = new GLGAFLedgerRecordsCreator(GAFRepository);

            GAFRepositoryMock.Setup(repo => repo.GetTaxPeriodByKey(_gafPeriodDataContext.GAFPeriod.BranchID, _gafPeriodDataContext.GAFPeriod.TaxAgencyID, _gafPeriodDataContext.GAFPeriod.TaxPeriodID))
            .Returns(_taxPeriodDataContext.TaxPeriod);

            GAFRepositoryMock.Setup(repo => repo.GetFinPeriodsInInterval(_taxPeriodDataContext.TaxPeriod.StartDate, _taxPeriodDataContext.TaxPeriod.EndDate))
            .Returns(_finPeriodDataContext.FinPeriod201503.SingleToArray());

            GAFRepositoryMock.Setup(repo => repo.GetBranchByID(_branchDataContext.Branch.BranchID))
            .Returns(_branchDataContext.Branch);

            GAFRepositoryMock.Setup(repo => repo.FindLastYearNotAdjustmentPeriod(It.IsAny <string>()))
            .Returns(new FinPeriod()
            {
                FinPeriodID = "201512"
            });
        }
Beispiel #5
0
        protected override void SetupRepositoryMethods(ICollection <APInvoiceAggregate> apInvoiceAggregs, string module, string docType, int?taxAgencyID, string taxPeriodID)
        {
            var refNbrs = apInvoiceAggregs.Select(apInvoiceAggr => apInvoiceAggr.Document.RefNbr)
                          .ToArray();

            SetupRepositoryMethodsBase(apInvoiceAggregs, module, docType, taxAgencyID, taxPeriodID, refNbrs);

            GAFRepositoryMock.Setup(repo => repo.GetReportedTaxAPRegistersWithTaxTransForDocuments(docType, refNbrs, taxAgencyID))
            .Returns(new PXResult <APRegister, TaxTran>[] { });
        }
 private void SetupGetSOInvoices()
 {
     GAFRepositoryMock.Setup(repo => repo.GetSOInvoices(ARDocType.Invoice, new[] { DocumentDataContext.RefNbr }))
     .Returns(() => new SOInvoice()
     {
         DocType       = ARDocType.Invoice,
         RefNbr        = DocumentDataContext.RefNbr,
         ShipAddressID = _soAddressDataContext.CustomerAddress.AddressID
     }.SingleToArray());
 }
Beispiel #7
0
        private void SetupRepositoryMethods(ICollection <TX.TaxAdjustment> taxAdjustments, ICollection <TaxTran> taxTrans, DocumentIDGroup documentIDGroup, string taxPeriodID)
        {
            GAFRepositoryMock.Setup <IEnumerable <TX.TaxAdjustment> >(repo => repo.GetTaxAdjustments(documentIDGroup.DocumentType,
                                                                                                     It.Is <string[]>(refNbrs => refNbrs.SequenceEqual(documentIDGroup.RefNbrs))))
            .Returns(taxAdjustments);

            GAFRepositoryMock.Setup(repo => repo.GetTaxTransForDocuments(documentIDGroup.Module,
                                                                         It.Is <string[]>(docTypes => docTypes.SequenceEqual(documentIDGroup.DocumentTypes)),
                                                                         It.Is <string[]>(refNbrs => refNbrs.SequenceEqual(documentIDGroup.RefNbrs)), taxPeriodID))
            .Returns(taxTrans);
        }
Beispiel #8
0
        private void SetupRepositoryMethodsBase(ICollection <APInvoiceAggregate> apInvoiceAggregs, string module,
                                                string docType, int?taxAgencyID, string taxPeriodID, string[] refNbrs)
        {
            var taxTrans =
                apInvoiceAggregs.SelectMany(
                    apInvoiceAggr => apInvoiceAggr.TaxTransByTax.Values.SelectMany(list => list.Select(tran => tran)));

            GAFRepositoryMock.Setup(
                repo => repo.GetReportedTaxTransForDocuments(module, docType, refNbrs, taxAgencyID, taxPeriodID))
            .Returns(taxTrans);

            SetupGetAPTranWithAPTaxForDocuments(docType, refNbrs, taxAgencyID, taxPeriodID, apInvoiceAggregs);
        }
        public void Test_CreateGAFRecordsForDocumentGroup_That_Country_Field_Is_Null_When_Country_Of_Billing_Address_Is_Malaysia()
        {
            Action setup = delegate()
            {
                GAFRepositoryMock.Setup(repo => repo.GetARAddress(ArAddressDataContext.CustomerAddress.AddressID))
                .Returns(new ARAddress()
                {
                    CountryID = SupplyRecordCountryBuilderForARInvoice.MalaysiaCountryCode
                });
            };

            Test_CreateGAFRecordsForDocumentGroup_That_Country_Field_Is_Null_When_Sale_Country_Is_Malaysia(BatchModule.AR, setup);
        }
Beispiel #10
0
        private void SetupRepositoryMethodsForDocumentsWithTaxDocumentTrans(ICollection <APInvoiceAggregate> apInvoiceAggregs, string module,
                                                                            string docType, int?taxAgencyID, string taxPeriodID, ICollection <APInvoiceAggregate> taxInvoiceAggregates)
        {
            var refNbrs = apInvoiceAggregs.Select(apInvoiceAggr => apInvoiceAggr.Document.RefNbr)
                          .ToArray();

            SetupRepositoryMethodsBase(apInvoiceAggregs, module, docType, taxAgencyID, taxPeriodID, refNbrs);

            GAFRepositoryMock.Setup(
                repo =>
                repo.GetReportedTaxAPRegistersWithTaxTransForDocuments(docType, refNbrs, taxAgencyID))
            .Returns(
                taxInvoiceAggregates.SelectMany(
                    taxInvAggr =>
                    taxInvAggr.TaxTransByTax.Values.SelectMany(
                        taxTrans => taxTrans.Select(taxTran => new PXResult <APRegister, TaxTran>(taxInvAggr.Document, taxTran)))));
        }
        protected override void SetupRepositoryMethods(ICollection <ARInvoiceAggregate> arInvoiceAggregs, string module, string docType, int?taxAgencyID, string taxPeriodID)
        {
            var refNbrs = arInvoiceAggregs.Select(apInvoiceAggr => apInvoiceAggr.Document.RefNbr)
                          .ToArray();

            var taxTrans =
                arInvoiceAggregs.SelectMany(
                    apInvoiceAggr => apInvoiceAggr.TaxTransByTax.Values.SelectMany(list => list.Select(tran => tran)));

            GAFRepositoryMock.Setup(repo => repo.GetReportedTaxTransForDocuments(module, docType, refNbrs, taxAgencyID, taxPeriodID))
            .Returns(taxTrans);

            SetupGetARTranWithARTaxForDocuments(docType, refNbrs, taxAgencyID, taxPeriodID, arInvoiceAggregs);

            GAFRepositoryMock.Setup(repo => repo.GetReportedTaxAPRegistersWithTaxTransForDocuments(docType, refNbrs, taxAgencyID))
            .Returns(new PXResult <APRegister, TaxTran>[] { });
        }
        public void Test_CreateLedgerRecords_GLTran_Record_Creation(string module, int?contragentID, string expectedContragentName)
        {
            //Arrange
            const decimal accountBegBalance = 5;

            SetupAccountsWithGLHistory(accountBegBalance, _finPeriodDataContext.FinPeriod201503.FinPeriodID);

            var glTran = new GLTran()
            {
                DebitAmt    = 5,
                CreditAmt   = 1,
                TranDesc    = "TranDesc",
                TranDate    = new DateTime(2015, 1, 3),
                BatchNbr    = "BN0001",
                RefNbr      = "REF0001",
                Module      = module,
                ReferenceID = contragentID
            };

            GAFRepositoryMock.Setup(repo => repo.GetPostedGLTrans(_branchDataContext.Branch.BranchID,
                                                                  _branchDataContext.Branch.LedgerID,
                                                                  _accountDataContext.AssetAccount.AccountID,
                                                                  _finPeriodDataContext.FinPeriod201503.FinPeriodID))
            .Returns(glTran.SingleToArray());

            //Action
            var ledgerRecord = _glgafLedgerRecordsCreator.CreateLedgerRecords(_gafPeriodDataContext.GAFPeriod)
                               .Last();

            //Assert
            Assert.Equal(glTran.TranDate, ledgerRecord.TransactionDate);
            Assert.Equal(_accountDataContext.AssetAccount.AccountCD, ledgerRecord.AccountID);
            Assert.Equal(_accountDataContext.AssetAccount.Description, ledgerRecord.AccountName);
            Assert.Equal(glTran.TranDesc, ledgerRecord.TransactionDescription);
            Assert.Equal(expectedContragentName, ledgerRecord.Name);
            Assert.Equal(glTran.BatchNbr, ledgerRecord.TransactionID);
            Assert.Equal(glTran.RefNbr, ledgerRecord.SourceDocumentID);
            Assert.Equal(glTran.Module, ledgerRecord.SourceType);

            Assert.Equal(glTran.DebitAmt, ledgerRecord.DebitAmount);
            Assert.Equal(glTran.CreditAmt, ledgerRecord.CreditAmount);
            Assert.Equal(accountBegBalance + (ledgerRecord.DebitAmount - ledgerRecord.CreditAmount), ledgerRecord.BalanceAmount);
        }
        public void Test_CreateLedgerRecords_That_Total_Of_Balance_Is_Calculated(decimal accountBeginBalance)
        {
            //Arrange
            SetupAccountsWithGLHistory(accountBeginBalance, _finPeriodDataContext.FinPeriod201503.FinPeriodID);

            var glTrans = new GLTran[]
            {
                new GLTran()
                {
                    TranDate  = new DateTime(),
                    DebitAmt  = 5,
                    CreditAmt = 1,
                },
                new GLTran()
                {
                    TranDate  = new DateTime(),
                    DebitAmt  = 10,
                    CreditAmt = 2,
                }
            };

            GAFRepositoryMock.Setup(repo => repo.GetPostedGLTrans(_branchDataContext.Branch.BranchID,
                                                                  _branchDataContext.Branch.LedgerID,
                                                                  _accountDataContext.AssetAccount.AccountID,
                                                                  _finPeriodDataContext.FinPeriod201503.FinPeriodID))
            .Returns(glTrans);

            //Action
            var ledgerRecords = _glgafLedgerRecordsCreator.CreateLedgerRecords(_gafPeriodDataContext.GAFPeriod);

            //Assert
            var tranRecordStartIndex = accountBeginBalance == 0
                                                                                                                ? 0
                                                                                                                : 1;

            var tranRecord1 = ledgerRecords[tranRecordStartIndex];
            var tranRecord2 = ledgerRecords[tranRecordStartIndex + 1];

            Assert.Equal(accountBeginBalance + (tranRecord1.DebitAmount - tranRecord1.CreditAmount), tranRecord1.BalanceAmount);
            Assert.Equal(tranRecord1.BalanceAmount + (tranRecord2.DebitAmount - tranRecord2.CreditAmount),
                         tranRecord2.BalanceAmount);
        }
Beispiel #14
0
        private void SetupRepositoryMethods(ICollection <GLTran> glTrans,
                                            CurrencyInfo curyInfo,
                                            ICollection <TaxTran> taxTrans,
                                            DocumentIDGroup documentIDGroup,
                                            int?branchID,
                                            string taxPeriodID,
                                            string[] taxIDs,
                                            TaxCategoryDet taxCategoryDet)
        {
            GAFRepositoryMock.Setup(repo => repo.GetTaxableGLTransWithCuryInfoGroupedByDocumentAttrAndTaxCategory(branchID,
                                                                                                                  It.Is <string[]>(refNbrs => refNbrs.SequenceEqual(documentIDGroup.RefNbrs))))
            .Returns(glTrans.Select(glTran => new PXResult <GLTran, CurrencyInfo>(glTran, curyInfo)));

            GAFRepositoryMock.Setup(repo => repo.GetTaxTransForDocuments(documentIDGroup.Module,
                                                                         It.Is <string[]>(refNbrs => refNbrs.SequenceEqual(documentIDGroup.DocumentTypes)),
                                                                         It.Is <string[]>(refNbrs => refNbrs.SequenceEqual(documentIDGroup.RefNbrs)), taxPeriodID))
            .Returns(taxTrans);

            GAFRepositoryMock.Setup(repo => repo.GetTaxCategoryDetsForTaxIDs(It.Is <string[]>(pTaxIDs => pTaxIDs.SequenceEqual(taxIDs))))
            .Returns(taxCategoryDet.SingleToArray());
        }
        private void SetupAccountsWithGLHistory(decimal accountYtdBalance, string resultFinPeriodID, string accountType = null, decimal?ptdDebit = null, decimal?ptdCredit = null)
        {
            var account = _accountDataContext.CreateAssetAccount();

            account.Type = accountType ?? account.Type;

            GAFRepositoryMock.Setup(repo => repo.GetAccountsWithDataToCalcBeginBalancesExcludingYTDNetIncAcc(_branchDataContext.Branch.BranchID,
                                                                                                             _branchDataContext.Branch.LedgerID,
                                                                                                             _finPeriodDataContext.FinPeriod201503.FinPeriodID))
            .Returns(new PXResult <Account, GLHistory, AH>(account,
                                                           new GLHistory()
            {
                PtdDebit  = ptdDebit,
                PtdCredit = ptdCredit
            },
                                                           new AH()
            {
                FinPeriodID = resultFinPeriodID,
                YtdBalance  = accountYtdBalance
            })
                     .SingleToArray());
        }
Beispiel #16
0
        protected void SetupGetAPTranWithAPTaxForDocuments(string docType, string[] refNbrs, int?taxAgencyID, string taxPeriodID, IEnumerable <APInvoiceAggregate> apInvoiceAggregates)
        {
            var mockResult = new List <PXResult <APTran, APTax> >();

            foreach (var apInvoiceAggregate in apInvoiceAggregates)
            {
                foreach (var apTranKvp in apInvoiceAggregate.TransByLineNbr)
                {
                    if (!apInvoiceAggregate.TranTaxesByLineNbrAndTax.ContainsKey(apTranKvp.Key))
                    {
                        continue;
                    }

                    foreach (var apTaxKvp in apInvoiceAggregate.TranTaxesByLineNbrAndTax[apTranKvp.Key])
                    {
                        mockResult.Add(new PXResult <APTran, APTax>(apTranKvp.Value, apTaxKvp.Value));
                    }
                }
            }

            GAFRepositoryMock.Setup(repo => repo.GetReportedAPTransWithAPTaxesForTaxCalcedOnItem(docType, refNbrs, taxAgencyID, taxPeriodID))
            .Returns(mockResult);
        }
        public void Test_CreateLedgerRecords_That_Adjustment_Period_Is_Joined_To_Last_Year_Period_And_Is_Exported()
        {
            //Arrange
            var accountHistoryPairs = new[]
            {
                new PXResult <Account, GLHistory, AH>(_accountDataContext.AssetAccount,
                                                      new GLHistory()
                {
                    FinPeriodID = _finPeriodDataContext.FinPeriod201503.FinPeriodID
                },
                                                      new AH()),
                new PXResult <Account, GLHistory, AH>(_accountDataContext.AssetAccount,
                                                      new GLHistory()
                {
                    FinPeriodID = _finPeriodDataContext.FinPeriod201504.FinPeriodID
                },
                                                      new AH())
            };

            GAFRepositoryMock.Setup(repo => repo.GetAccountsWithDataToCalcBeginBalancesExcludingYTDNetIncAcc(_branchDataContext.Branch.BranchID,
                                                                                                             _branchDataContext.Branch.LedgerID,
                                                                                                             It.IsAny <string>()))
            .Returns <int?, int?, string>((b, l, finPeriodID) => accountHistoryPairs.Where(pair => ((GLHistory)pair).FinPeriodID == finPeriodID));

            GAFRepositoryMock.Setup(repo => repo.FindLastYearNotAdjustmentPeriod(_finPeriodDataContext.FinPeriod201503.FinYear))
            .Returns(_finPeriodDataContext.FinPeriod201503);

            GAFRepositoryMock.Setup(repo => repo.GetAdjustmentFinPeriods(_finPeriodDataContext.FinPeriod201503.FinYear))
            .Returns(_finPeriodDataContext.FinPeriod201504.SingleToArray());

            var glTrans = new GLTran[]
            {
                new GLTran()
                {
                    AccountID   = _accountDataContext.AssetAccount.AccountID,
                    DebitAmt    = 5,
                    CreditAmt   = 1,
                    TranDesc    = "TranDesc1",
                    TranDate    = new DateTime(2015, 1, 1),
                    BatchNbr    = "BN0001",
                    RefNbr      = "REF0001",
                    Module      = BatchModule.AP,
                    ReferenceID = VendorDataContext.VendorID,
                    FinPeriodID = _finPeriodDataContext.FinPeriod201503.FinPeriodID
                },
                new GLTran()
                {
                    AccountID   = _accountDataContext.AssetAccount.AccountID,
                    DebitAmt    = 6,
                    CreditAmt   = 3,
                    TranDesc    = "TranDesc2",
                    TranDate    = new DateTime(2015, 1, 2),
                    BatchNbr    = "BN0002",
                    RefNbr      = "REF0002",
                    Module      = BatchModule.AR,
                    ReferenceID = CustomerDataContext.CustomerID,
                    FinPeriodID = _finPeriodDataContext.FinPeriod201504.FinPeriodID
                }
            };

            GAFRepositoryMock.Setup(repo => repo.GetPostedGLTrans(_branchDataContext.Branch.BranchID,
                                                                  _branchDataContext.Branch.LedgerID,
                                                                  _accountDataContext.AssetAccount.AccountID,
                                                                  It.IsAny <string>()))
            .Returns <int?, int?, int?, string>((b, l, a, finPeriodID) => glTrans.Where(glTran => glTran.FinPeriodID == finPeriodID));

            //Action
            var ledgerRecords = _glgafLedgerRecordsCreator.CreateLedgerRecords(_gafPeriodDataContext.GAFPeriod);

            //Assert
            Approvals.VerifyAll(ledgerRecords, "ledgerRecords", record => record.Dump());
        }
        public void Test_CreateLedgerRecords_With_Two_Accounts_And_Two_Trans()
        {
            //Arrange
            var accountHistoryData = new []
            {
                new PXResult <Account, GLHistory, AH>(_accountDataContext.AssetAccount,
                                                      new GLHistory()
                {
                    PtdCredit = 1,
                    PtdDebit  = 3
                },
                                                      new AH()
                {
                    FinPeriodID = _finPeriodDataContext.FinPeriod201503.FinPeriodID,
                    YtdBalance  = 6
                }),
                new PXResult <Account, GLHistory, AH>(_accountDataContext.LiablityAccount,
                                                      new GLHistory()
                {
                    PtdCredit = 9,
                    PtdDebit  = 2
                },
                                                      new AH()
                {
                    FinPeriodID = _finPeriodDataContext.FinPeriod201503.FinPeriodID,
                    YtdBalance  = 15
                })
            };

            GAFRepositoryMock.Setup(repo => repo.GetAccountsWithDataToCalcBeginBalancesExcludingYTDNetIncAcc(_branchDataContext.Branch.BranchID,
                                                                                                             _branchDataContext.Branch.LedgerID,
                                                                                                             _finPeriodDataContext.FinPeriod201503.FinPeriodID))
            .Returns(accountHistoryData);

            var glTrans = new GLTran[] { new GLTran()
                                         {
                                             AccountID   = _accountDataContext.AssetAccount.AccountID,
                                             DebitAmt    = 5,
                                             CreditAmt   = 1,
                                             TranDesc    = "TranDesc1",
                                             TranDate    = new DateTime(2015, 1, 1),
                                             BatchNbr    = "BN0001",
                                             RefNbr      = "REF0001",
                                             Module      = BatchModule.AP,
                                             ReferenceID = VendorDataContext.VendorID
                                         },
                                         new GLTran()
                                         {
                                             AccountID   = _accountDataContext.AssetAccount.AccountID,
                                             DebitAmt    = 6,
                                             CreditAmt   = 3,
                                             TranDesc    = "TranDesc2",
                                             TranDate    = new DateTime(2015, 1, 2),
                                             BatchNbr    = "BN0002",
                                             RefNbr      = "REF0002",
                                             Module      = BatchModule.AR,
                                             ReferenceID = CustomerDataContext.CustomerID
                                         },
                                         new GLTran()
                                         {
                                             AccountID   = _accountDataContext.LiablityAccount.AccountID,
                                             DebitAmt    = 9,
                                             CreditAmt   = 15,
                                             TranDesc    = "TranDesc3",
                                             TranDate    = new DateTime(2015, 1, 3),
                                             BatchNbr    = "BN0003",
                                             RefNbr      = "REF0003",
                                             Module      = BatchModule.SO,
                                             ReferenceID = CustomerDataContext.CustomerID
                                         },
                                         new GLTran()
                                         {
                                             AccountID   = _accountDataContext.LiablityAccount.AccountID,
                                             DebitAmt    = 20,
                                             CreditAmt   = 7,
                                             TranDesc    = "TranDesc4",
                                             TranDate    = new DateTime(2015, 1, 4),
                                             BatchNbr    = "BN0004",
                                             RefNbr      = "REF0004",
                                             Module      = BatchModule.PO,
                                             ReferenceID = VendorDataContext.VendorID
                                         } };

            GAFRepositoryMock.Setup(repo => repo.GetPostedGLTrans(_branchDataContext.Branch.BranchID,
                                                                  _branchDataContext.Branch.LedgerID,
                                                                  It.IsAny <int?>(),
                                                                  _finPeriodDataContext.FinPeriod201503.FinPeriodID))
            .Returns <int?, int?, int?, string>((b, l, accountID, fp) => glTrans.Where(glTran => glTran.AccountID == accountID));

            //Action
            var ledgerRecords = _glgafLedgerRecordsCreator.CreateLedgerRecords(_gafPeriodDataContext.GAFPeriod);

            //Assert
            Approvals.VerifyAll(ledgerRecords, "ledgerRecords", record => record.Dump());
        }