Пример #1
0
        public void InitDefaultValues()
        {
            TranDate = DateTime.Now.Date;

            var setOfBooks = SetOfBooks.GetInstance(Session);

            if (setOfBooks != null)
            {
                CounterCcy = setOfBooks.FunctionalCurrency;
            }

            var bsDefs = BankStmtDefaults.GetInstance(Session);

            if (bsDefs != null)
            {
                TranCode = bsDefs.TranCode;
            }

            var cfDefs = CashFlowDefaults.GetInstance(Session);

            if (cfDefs != null)
            {
                Counterparty = cfDefs.Counterparty;
                Account      = cfDefs.Account;
                Activity     = cfDefs.Activity;
            }
        }
Пример #2
0
 public override void OnSetup()
 {
     CashDiscipline.Module.DatabaseUpdate.Updater.CreateCurrencies(ObjectSpace);
     SetOfBooks.GetInstance(ObjectSpace);
     CashDiscipline.Module.DatabaseUpdate.Updater.InitSetOfBooks(ObjectSpace);
     CashDiscipline.Module.DatabaseUpdate.Updater.CreateDbObjects(ObjectSpace);
 }
Пример #3
0
        public override void OnSetup()
        {
            CashDisciplineTestHelper.RegisterCustomFunctions();
            CashDiscipline.Module.DatabaseUpdate.Updater.CreateDbObjects(ObjectSpace);

            CashDiscipline.Module.DatabaseUpdate.Updater.CreateCurrencies(ObjectSpace);
            SetOfBooks.GetInstance(ObjectSpace);
            CashDiscipline.Module.DatabaseUpdate.Updater.InitSetOfBooks(ObjectSpace);
        }
Пример #4
0
        public void AutoreconcileTransfers(System.Collections.IEnumerable bankStmts, bool commit)
        {
            // get session from first BankStmt. This assumes the same sessions are being used.
            Session session = null;

            foreach (BankStmt bs in bankStmts)
            {
                session = bs.Session;
                break;
            }
            var snapshot = SetOfBooks.GetInstance(session).CurrentCashFlowSnapshot;

            if (session == null)
            {
                return;
            }
            var transferActivity = session.GetObjectByKey <Activity>(
                SetOfBooks.CachedInstance.ForexSettleActivity.Oid);

            foreach (BankStmt bsi in bankStmts)
            {
                //Debug.Print(string.Format("Autoreconcile Activity {0} with {1}", bsi.Activity.Name, transferActivity.Name));
                if (bsi.Activity != null && bsi.Activity.Oid == transferActivity.Oid)
                {
                    // reconcile transfer
                    var cf = session.FindObject <CashFlow>(CriteriaOperator.Parse(
                                                               "TranDate = ? And Activity = ? And AccountCcyAmt = ? And Snapshot = ?",
                                                               bsi.TranDate, transferActivity, bsi.TranAmount, snapshot));
                    if (cf == null)
                    {
                        break;
                    }

                    BankStmtCashFlowForecast bsCff = ReconcileForecast(session, bsi, cf);
                    ChangeBankStmtToCashFlowForecast(bsCff.BankStmt, bsCff.CashFlow);
                }
                else
                {
                    // reconcile anything else with matching date and amount
                    var cf = session.FindObject <CashFlow>(CriteriaOperator.Parse(
                                                               "TranDate = ? And AccountCcyAmt = ? And Snapshot = ?",
                                                               bsi.TranDate, bsi.TranAmount, snapshot));
                    if (cf == null)
                    {
                        break;
                    }

                    BankStmtCashFlowForecast bsCff = ReconcileForecast(session, bsi, cf);
                    ChangeBankStmtToCashFlowForecast(bsCff.BankStmt, bsCff.CashFlow);
                }
            }
            if (commit)
            {
                session.CommitTransaction();
            }
        }
Пример #5
0
        public static void InitSetOfBooks(IObjectSpace objSpace)
        {
            var setOfBooks = SetOfBooks.GetInstance(objSpace);

            if (setOfBooks.ForexSettleActivity == null)
            {
                var activity = objSpace.FindObject <Activity>(CriteriaOperator.Parse("Name = ?", "Transfer"));
                if (activity == null)
                {
                    activity      = objSpace.CreateObject <Activity>();
                    activity.Name = "Transfer";
                    activity.Save();
                }
                setOfBooks.ForexSettleActivity = activity;
            }

            // requires CreateCurrencies
            setOfBooks.FunctionalCurrency = objSpace.FindObject <Currency>(
                CriteriaOperator.Parse(Currency.FieldNames.Name + " = ?", "AUD"));

            if (setOfBooks.ForexSettleCashFlowSource == null)
            {
                var source = objSpace.FindObject <CashFlowSource>(CriteriaOperator.Parse("Name = ?", "Fx Trade"));
                if (source == null)
                {
                    source      = objSpace.CreateObject <CashFlowSource>();
                    source.Name = "Fx Trade";
                    source.Save();
                }
                setOfBooks.ForexSettleCashFlowSource = source;
            }
            if (setOfBooks.BankStmtCashFlowSource == null)
            {
                var source = objSpace.FindObject <CashFlowSource>(CriteriaOperator.Parse("Name = ?", "Stmt"));
                if (source == null)
                {
                    source      = objSpace.CreateObject <CashFlowSource>();
                    source.Name = "Stmt";
                    source.Save();
                }
                setOfBooks.BankStmtCashFlowSource = source;
            }
            if (setOfBooks.CurrentCashFlowSnapshot == null)
            {
                var snapshot = objSpace.CreateObject <CashFlowSnapshot>();
                snapshot.Name = "Current";
                snapshot.Save();
                setOfBooks.CurrentCashFlowSnapshot = snapshot;
            }

            objSpace.CommitChanges();
        }
Пример #6
0
        public FixCashFlowsAlgorithm(XPObjectSpace objSpace, CashFlowFixParam paramObj, CashFlowFixMapper mapper)
        {
            this.objSpace = objSpace;
            this.paramObj = paramObj;

            if (paramObj.Snapshot == null)
            {
                currentSnapshot = GetCurrentSnapshot(objSpace.Session);
            }
            else
            {
                currentSnapshot = paramObj.Snapshot;
            }

            if (paramObj.ApReclassActivity != null)
            {
                paramApReclassActivity = objSpace.GetObjectByKey <Activity>(objSpace.GetKeyValue(paramObj.ApReclassActivity));
            }

            defaultCounterparty = objSpace.FindObject <Counterparty>(
                CriteriaOperator.Parse("Name LIKE ?", CashDiscipline.Common.Constants.DefaultFixCounterparty));

            var query = new XPQuery <CashForecastFixTag>(objSpace.Session);

            reversalFixTag = query
                             .Where(x => x.Name == CashDiscipline.Common.Constants.ReversalFixTag).FirstOrDefault();

            revRecFixTag = query
                           .Where(x => x.Name == CashDiscipline.Common.Constants.RevRecFixTag).FirstOrDefault();

            resRevRecFixTag = query
                              .Where(x => x.Name == CashDiscipline.Common.Constants.ResRevRecFixTag).FirstOrDefault();

            payrollFixTag = query
                            .Where(x => x.Name == CashDiscipline.Common.Constants.PayrollFixTag).FirstOrDefault();

            autoFixTag = query
                         .Where(x => x.Name == CashDiscipline.Common.Constants.AutoFixTag).FirstOrDefault();

            setOfBooks  = SetOfBooks.GetInstance(objSpace);
            this.mapper = mapper;

            this.sqlDeclareClauses = CreateSqlDeclareClauses();
            var sqlStringUtil = new SqlStringUtil();

            this.parameterCommandText = sqlStringUtil.CreateCommandText(sqlDeclareClauses);
        }
Пример #7
0
        public IList <CashFlow> GetSourceObjects(IEnumerable <Activity> activitiesToMap, IEnumerable <Account> accountsToMap)
        {
            var paramObj        = this.paramObj;
            var session         = paramObj.Session;
            var excludeSource   = SetOfBooks.GetInstance(objSpace).BankStmtCashFlowSource;
            var currentSnapshot = SetOfBooks.GetInstance(objSpace).CurrentCashFlowSnapshot;

            var cop = CriteriaOperator.Parse(
                string.Format("{0} Between(?, ?) And {1} <> ? And {2} = ?",
                              CashFlow.Fields.TranDate.PropertyName,
                              CashFlow.Fields.Source.PropertyName,
                              CashFlow.Fields.Snapshot.PropertyName),
                paramObj.FromDate, paramObj.ToDate, excludeSource, currentSnapshot);

            cop = GroupOperator.And(cop, new InOperator("Activity", activitiesToMap));
            cop = GroupOperator.And(cop, new InOperator("Account", accountsToMap));
            return(new XPCollection <CashFlow>(session, cop));
        }
Пример #8
0
        public void CalculateCounterCcyAmt(Currency fromCcy, decimal fromAmt)
        {
            var toCcy = SetOfBooks.GetInstance(fromCcy.Session).FunctionalCurrency;

            if (fromCcy.Session != toCcy.Session)
            {
                throw new InvalidOperationException("Both currencies must be in the same session.");
            }

            var rateObj = GetForexRateObject(fromCcy, toCcy, ValueDate);

            if (rateObj != null)
            {
                var usedRate = rateObj.ConversionRate;
                SetPropertyValue("Rate", ref _Rate, usedRate);
                SetPropertyValue("PrimaryCcyAmt", ref _PrimaryCcyAmt, Math.Round(fromAmt * usedRate, 2));
            }
        }
Пример #9
0
        public void UpdateRate()
        {
            var fromAmt = CounterCcyAmt;
            var fromCcy = CounterCcy;

            if (this.PrimaryCcyAmt != 0.00M && this.CounterCcyAmt != 0.00M)
            {
                this.SetPropertyValue("Rate", ref this._Rate, Math.Round(this.CounterCcyAmt / this.PrimaryCcyAmt, 5));
            }
            else if (this.ValueDate != default(DateTime))
            {
                var toCcy    = SetOfBooks.GetInstance(fromCcy.Session).FunctionalCurrency;
                var ratethis = GetForexRateObject(fromCcy, toCcy, this.ValueDate);
                if (ratethis != null)
                {
                    var value = Math.Round(fromAmt * (decimal)ratethis.ConversionRate, 2);
                    this.SetPropertyValue("PrimaryCcyAmt", ref this._PrimaryCcyAmt, value);
                }
            }
        }
Пример #10
0
        public static void UpdateFunctionalCcyAmt(BankStmt obj, decimal fromAmt, Currency fromCcy)
        {
            var session = obj.Session;

            if (fromCcy == null)
            {
                return;
            }
            if (SetOfBooks.CachedInstance.FunctionalCurrency.Oid == fromCcy.Oid)
            {
                obj.FunctionalCcyAmt = fromAmt;
            }
            else if (obj.TranDate != default(DateTime))
            {
                var rateObj = GetForexRateObject(session, fromCcy, SetOfBooks.GetInstance(obj.Session).FunctionalCurrency, (DateTime)obj.TranDate);
                if (rateObj != null)
                {
                    // TODO: do not assume that Functional Currency is 'AUD'
                    var value = fromAmt * (decimal)rateObj.ConversionRate;
                    obj.SetPropertyValue("FunctionalCcyAmt", ref obj._FunctionalCcyAmt, Math.Round(value, 2));
                }
            }
        }
Пример #11
0
        public static void UpdateFunctionalCcyAmt(CashFlow obj, decimal fromAmt, Currency fromCcy)
        {
            if (obj == null || fromCcy == null)
            {
                return;
            }
            var session = obj.Session;

            var funcCcy = SetOfBooks.GetInstance(session).FunctionalCurrency;

            if (SetOfBooks.CachedInstance.FunctionalCurrency.Oid == fromCcy.Oid)
            {
                obj.FunctionalCcyAmt = fromAmt;
            }
            else if (obj.TranDate != default(DateTime))
            {
                var rateObj = GetForexRateObject(session, fromCcy, funcCcy, (DateTime)obj.TranDate);
                if (rateObj != null)
                {
                    var value = fromAmt * (decimal)rateObj.ConversionRate;
                    obj.FunctionalCcyAmt = value;
                }
            }
        }
Пример #12
0
        public void GetSetOfBooksInstance()
        {
            #region Arrange

            ObjectSpace.Session.Delete(new XPCollection(ObjectSpace.Session, typeof(SetOfBooks)));
            ObjectSpace.CommitChanges();

            var setOfBooks = SetOfBooks.GetInstance(ObjectSpace.Session);
            ObjectSpace.CommitChanges();

            var os = (XPObjectSpace)Application.CreateObjectSpace();

            #endregion

            #region Assert that SetOfBooks is not null

            var setOfBooks1 = ObjectSpace.GetObjects <SetOfBooks>();
            Assert.AreEqual(1, setOfBooks1.Count);

            var setOfBooks2 = os.Session.FindObject <SetOfBooks>(PersistentCriteriaEvaluationBehavior.InTransaction, null);
            Assert.NotNull(setOfBooks2);

            #endregion
        }
 protected override void InitializeItems()
 {
     base.InitializeItems();
     SetOfBooks.GetInstance(Application);
 }
Пример #14
0
        public void ReconcileBankStmtToCashFlowSnapshot()
        {
            #region Arrange Forex objects
            // Currencies
            var ccyAUD = ObjectSpace.FindObject <Currency>(CriteriaOperator.Parse("Name = ?", "AUD"));
            var ccyUSD = ObjectSpace.FindObject <Currency>(CriteriaOperator.Parse("Name = ?", "USD"));

            // Forex Rates
            var rate = ObjectSpace.CreateObject <ForexRate>();
            rate.ConversionDate = new DateTime(2013, 11, 01);
            rate.FromCurrency   = ccyAUD;
            rate.ToCurrency     = ccyUSD;
            rate.ConversionRate = 0.9M;
            rate.Save();
            ObjectSpace.CommitChanges();

            // Constants
            decimal rate1 = 0.95M;
            #endregion

            #region Arrange Lookup Objects

            var priAccount = ObjectSpace.CreateObject <Account>();
            priAccount.Name     = "VHA ANZ 70086";
            priAccount.Currency = ccyAUD;

            var couAccount = ObjectSpace.CreateObject <Account>();
            couAccount.Name     = "VHA ANZ USD";
            couAccount.Currency = ccyUSD;

            var forexActivity = SetOfBooks.GetInstance(ObjectSpace).ForexSettleActivity;

            var outActivity = ObjectSpace.CreateObject <Activity>();
            outActivity.Name = "AP Pymt";

            var outCounterparty = ObjectSpace.CreateObject <Counterparty>();
            outCounterparty.Name = "UNDEFINED";

            var inCounterparty = ObjectSpace.CreateObject <Counterparty>();
            inCounterparty.Name = "ANZ";

            var forexCounterparty = ObjectSpace.CreateObject <ForexCounterparty>();
            forexCounterparty.Name = "ANZ";
            forexCounterparty.CashFlowCounterparty = inCounterparty;

            var snapshot1 = ObjectSpace.CreateObject <CashFlowSnapshot>();
            snapshot1.Name = "Snapshot 1";
            #endregion


            #region Create Cash Flow Forex Trade Objects

            var cfCouForex1 = ObjectSpace.CreateObject <CashFlow>();
            cfCouForex1.CalculateEnabled = false;
            cfCouForex1.TranDate         = new DateTime(2013, 11, 16);
            cfCouForex1.Account          = couAccount;
            cfCouForex1.Activity         = forexActivity;
            cfCouForex1.Counterparty     = inCounterparty;
            cfCouForex1.AccountCcyAmt    = 100;
            cfCouForex1.FunctionalCcyAmt = 100 / rate1;
            cfCouForex1.CounterCcyAmt    = 100;
            cfCouForex1.CounterCcy       = ccyUSD;
            cfCouForex1.ForexSettleType  = CashFlowForexSettleType.In;
            cfCouForex1.Description      = "cfCouForex1";
            cfCouForex1.Save();

            var cfPriForex1 = ObjectSpace.CreateObject <CashFlow>();
            cfPriForex1.CalculateEnabled = false;
            cfPriForex1.TranDate         = new DateTime(2013, 11, 16);
            cfPriForex1.Account          = priAccount;
            cfPriForex1.Activity         = forexActivity;
            cfPriForex1.Counterparty     = inCounterparty;
            cfPriForex1.AccountCcyAmt    = -100 / rate1;
            cfPriForex1.FunctionalCcyAmt = -100 / rate1;
            cfPriForex1.CounterCcyAmt    = 100;
            cfPriForex1.CounterCcy       = ccyUSD;
            cfPriForex1.ForexSettleType  = CashFlowForexSettleType.In;
            cfPriForex1.Description      = "cfPriForex1";
            cfPriForex1.Save();

            var cfCouForex1a = ObjectSpace.CreateObject <CashFlow>();
            cfCouForex1a.CalculateEnabled = false;
            cfCouForex1a.TranDate         = new DateTime(2013, 11, 16);
            cfCouForex1a.Account          = couAccount;
            cfCouForex1a.Activity         = forexActivity;
            cfCouForex1a.Counterparty     = inCounterparty;
            cfCouForex1a.AccountCcyAmt    = 100;
            cfCouForex1a.FunctionalCcyAmt = 100 / rate1;
            cfCouForex1a.CounterCcyAmt    = 100;
            cfCouForex1a.CounterCcy       = ccyUSD;
            cfCouForex1a.ForexSettleType  = CashFlowForexSettleType.In;
            cfCouForex1a.Description      = "cfCouForex1a";
            cfCouForex1a.Snapshot         = snapshot1;
            cfCouForex1a.Save();

            var cfPriForex1a = ObjectSpace.CreateObject <CashFlow>();
            cfPriForex1a.CalculateEnabled = false;
            cfPriForex1a.TranDate         = new DateTime(2013, 11, 16);
            cfPriForex1a.Account          = priAccount;
            cfPriForex1a.Activity         = forexActivity;
            cfPriForex1a.Counterparty     = inCounterparty;
            cfPriForex1a.AccountCcyAmt    = -100 / rate1;
            cfPriForex1a.FunctionalCcyAmt = -100 / rate1;
            cfPriForex1a.CounterCcyAmt    = 100;
            cfPriForex1a.CounterCcy       = ccyUSD;
            cfPriForex1a.ForexSettleType  = CashFlowForexSettleType.In;
            cfPriForex1a.Description      = "cfPriForex1a";
            cfPriForex1a.Snapshot         = snapshot1;
            cfPriForex1a.Save();

            #endregion

            #region Arrange Bank Stmt Forex Trade objects

            var bsCouForex1 = ObjectSpace.CreateObject <BankStmt>();
            bsCouForex1.TranDate           = new DateTime(2013, 11, 16);
            bsCouForex1.Account            = couAccount;
            bsCouForex1.Activity           = forexActivity;
            bsCouForex1.Counterparty       = outCounterparty;
            bsCouForex1.TranAmount         = 100;
            bsCouForex1.ForexSettleType    = CashFlowForexSettleType.In;
            bsCouForex1.SummaryDescription = "bsCouForex1";
            bsCouForex1.Save();

            var bsPriForex1 = ObjectSpace.CreateObject <BankStmt>();
            bsPriForex1.TranDate           = new DateTime(2013, 11, 16);
            bsPriForex1.Account            = priAccount;
            bsPriForex1.Activity           = forexActivity;
            bsPriForex1.Counterparty       = outCounterparty;
            bsPriForex1.TranAmount         = -100 / rate1;
            bsPriForex1.ForexSettleType    = CashFlowForexSettleType.In;
            bsPriForex1.SummaryDescription = "bsPriForex1";
            bsPriForex1.Save();

            #endregion

            #region Reconcile Bank Stmt

            ObjectSpace.CommitChanges();
            var bankStmts  = ObjectSpace.GetObjects <BankStmt>();
            var reconciler = new BankStmtForecastReconciler((XPObjectSpace)ObjectSpace);
            BankStmtCashFlowForecast bsCff = reconciler.ReconcileItem(bsCouForex1, cfCouForex1a);
            ObjectSpace.CommitChanges();
            #endregion

            #region Assert
            Assert.AreEqual("cfCouForex1a", bsCouForex1.SummaryDescription);
            #endregion
        }
Пример #15
0
        public static CashFlowSnapshot GetCurrentSnapshot(Session session)
        {
            var setOfBooks = SetOfBooks.GetInstance(session);

            return(session.GetObjectByKey <CashFlowSnapshot>(setOfBooks.CurrentCashFlowSnapshot.Oid));
        }
Пример #16
0
        public void RevalueForeignCurrencyAccounts()
        {
            #region Arrange

            var ccyAUD = ObjectSpace.FindObject <Currency>(CriteriaOperator.Parse("Name = ?", "AUD"));
            var ccyUSD = ObjectSpace.FindObject <Currency>(CriteriaOperator.Parse("Name = ?", "USD"));
            var ccyEUR = ObjectSpace.FindObject <Currency>(CriteriaOperator.Parse("Name = ?", "EUR"));

            var unrealActivity = ObjectSpace.CreateObject <Activity>();
            unrealActivity.Name = "Unreal Fx Gain";

            var usdAccount = ObjectSpace.CreateObject <Account>();
            usdAccount.Name     = "VHA ANZ USD";
            usdAccount.Currency = ccyUSD;

            var eurAccount = ObjectSpace.CreateObject <Account>();
            eurAccount.Name     = "VHA ANZ EUR";
            eurAccount.Currency = ccyEUR;

            var revalSource = ObjectSpace.CreateObject <CashFlowSource>();
            revalSource.Name = "UnrealFx";

            var sob = SetOfBooks.GetInstance(ObjectSpace);
            sob.FcaRevalCashFlowSource = revalSource;
            sob.UnrealFxActivity       = unrealActivity;

            var usdRate1 = ObjectSpace.CreateObject <ForexRate>();
            usdRate1.FromCurrency   = ccyAUD;
            usdRate1.ToCurrency     = ccyUSD;
            usdRate1.ConversionDate = new DateTime(2016, 6, 10);
            usdRate1.ConversionRate = 0.8M;
            ObjectSpace.CommitChanges();

            var usdRate2 = ObjectSpace.CreateObject <ForexRate>();
            usdRate2.FromCurrency   = ccyAUD;
            usdRate2.ToCurrency     = ccyUSD;
            usdRate2.ConversionDate = new DateTime(2016, 6, 25);
            usdRate2.ConversionRate = 0.75M;
            ObjectSpace.CommitChanges();

            var usdRate3 = ObjectSpace.CreateObject <ForexRate>();
            usdRate3.FromCurrency   = ccyAUD;
            usdRate3.ToCurrency     = ccyUSD;
            usdRate3.ConversionDate = new DateTime(2016, 6, 29);
            usdRate3.ConversionRate = 0.70M;
            ObjectSpace.CommitChanges();

            var eurRate1 = ObjectSpace.CreateObject <ForexRate>();
            eurRate1.FromCurrency   = ccyAUD;
            eurRate1.ToCurrency     = ccyEUR;
            eurRate1.ConversionDate = new DateTime(2016, 6, 10);
            eurRate1.ConversionRate = 0.69M;
            ObjectSpace.CommitChanges();

            var eurRate2 = ObjectSpace.CreateObject <ForexRate>();
            eurRate2.FromCurrency   = ccyAUD;
            eurRate2.ToCurrency     = ccyEUR;
            eurRate2.ConversionDate = new DateTime(2016, 6, 25);
            eurRate2.ConversionRate = 0.65M;
            ObjectSpace.CommitChanges();

            var eurRate3 = ObjectSpace.CreateObject <ForexRate>();
            eurRate3.FromCurrency   = ccyAUD;
            eurRate3.ToCurrency     = ccyEUR;
            eurRate3.ConversionDate = new DateTime(2016, 6, 29);
            eurRate3.ConversionRate = 0.6M;
            ObjectSpace.CommitChanges();

            #endregion

            #region Act

            var usdCf1 = ObjectSpace.CreateObject <CashFlow>();
            usdCf1.TranDate      = new DateTime(2016, 6, 11);
            usdCf1.Account       = usdAccount;
            usdCf1.AccountCcyAmt = 1000;
            ObjectSpace.CommitChanges();

            var usdCf2 = ObjectSpace.CreateObject <CashFlow>();
            usdCf2.TranDate      = new DateTime(2016, 6, 13);
            usdCf2.Account       = usdAccount;
            usdCf2.AccountCcyAmt = 500;
            ObjectSpace.CommitChanges();

            var eurCf1 = ObjectSpace.CreateObject <CashFlow>();
            eurCf1.TranDate      = new DateTime(2016, 6, 11);
            eurCf1.Account       = eurAccount;
            eurCf1.AccountCcyAmt = 600;
            ObjectSpace.CommitChanges();

            var eurCf2 = ObjectSpace.CreateObject <CashFlow>();
            eurCf2.TranDate      = new DateTime(2016, 6, 13);
            eurCf2.Account       = eurAccount;
            eurCf2.AccountCcyAmt = 200;
            ObjectSpace.CommitChanges();

            var eurCf3 = ObjectSpace.CreateObject <CashFlow>();
            eurCf3.TranDate      = new DateTime(2016, 6, 30);
            eurCf3.Account       = eurAccount;
            eurCf3.AccountCcyAmt = 1;
            ObjectSpace.CommitChanges();

            var paramObj = ObjectSpace.CreateObject <CashFlowFixParam>();
            paramObj.FromDate = new DateTime(2016, 05, 01);
            paramObj.ToDate   = new DateTime(2016, 12, 31);
            ObjectSpace.CommitChanges();

            var revaluer = new RevalueAccounts(ObjectSpace, paramObj);
            revaluer.Process();

            #endregion

            #region Assert

            ObjectSpace.CommitChanges();
            ObjectSpace.Refresh();

            var cashFlows = ObjectSpace.GetObjects <CashFlow>();
            Assert.AreEqual(Math.Round(1500.00 / 0.7, 0),
                            Math.Round(cashFlows.Where(x => x.Account.Oid == usdAccount.Oid).Sum(c => c.FunctionalCcyAmt), 0));

            Assert.AreEqual(Math.Round(801 / 0.6, 0),
                            Math.Round(cashFlows.Where(x => x.Account.Oid == eurAccount.Oid).Sum(c => c.FunctionalCcyAmt), 0));

            Assert.AreEqual(Math.Round(usdCf1.AccountCcyAmt / usdRate1.ConversionRate, 2),
                            Math.Round(usdCf1.FunctionalCcyAmt, 2));

            #endregion
        }