コード例 #1
0
        public void TestCtor()
        {
            var testSubject = new AmericanAssets();

            Assert.IsNotNull(testSubject.MyItems);
            Assert.AreEqual(0, testSubject.MyItems.Count);

            //var futures =
            //    NamedReceivable.RandomNamedReceivalbleWithHistoryToSum("Futures", "Securities", 9000D.ToPecuniam());
            //testSubject.AddItem(futures);

            testSubject.AddItem("Futures", "Securities", 9000D.ToPecuniam());
            var testResultSum = testSubject.Total;

            Assert.IsNotNull(testResultSum);
            Assert.AreNotEqual(Pecuniam.Zero, testResultSum);
            Assert.AreEqual(9000D.ToPecuniam(), testResultSum);

            var stocks =
                NamedTradeline.RandomNamedTradelineWithHistoryToSum("Stocks", "Securities", 2000D.ToPecuniam());

            testSubject.AddItem(stocks);

            testResultSum = testSubject.Total.GetWholeNumber();
            Assert.AreNotEqual(Pecuniam.Zero, testResultSum);
            Assert.AreEqual(11000D.ToPecuniam(), testResultSum);
        }
コード例 #2
0
ファイル: WealthBase.cs プロジェクト: nofuture-git/31g
        /// <summary>
        /// While <see cref="GetItemsForRange(AmericanDomusOpesOptions)"/> deals with all the
        /// items of this <see cref="DivisionName"/> this is concerned with one-item-at-a-time.
        /// </summary>
        /// <param name="itemName"></param>
        /// <param name="grpName"></param>
        /// <param name="options"></param>
        /// <param name="rate"></param>
        /// <returns></returns>
        protected internal virtual NamedTradeline GetNamedReceivableForItemAndGroup(string itemName, string grpName, AmericanDomusOpesOptions options, double rate)
        {
            options = options ?? AmericanDomusOpesOptions.RandomOpesOptions();

            var calcValueR = CalcValue((options.SumTotal ?? 0).ToPecuniam(), rate);
            var p          = NamedTradeline.RandomNamedTradelineWithHistoryToSum(itemName, grpName, calcValueR,
                                                                                 options.DueFrequency, options.Inception, options.Terminus);

            return(p);
        }
コード例 #3
0
        public void TestRandomNamedReceivalbleWithHistoryToSum()
        {
            var testResult =
                NamedTradeline.RandomNamedTradelineWithHistoryToSum("first name", "group name",
                                                                    120000M.ToPecuniam());
            var testResultValue = testResult.Value;

            Console.WriteLine(testResultValue);
            Assert.AreEqual(120000M.ToPecuniam(), testResultValue);
        }
コード例 #4
0
        /// <summary>
        /// Composes the items for Public Benefits (a.k.a. welfare) whenever
        /// income is below the federal poverty level
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        protected internal virtual NamedTradeline[] GetPublicBenefitIncomeItemsForRange(AmericanDomusOpesOptions options)
        {
            options = options ?? AmericanDomusOpesOptions.RandomOpesOptions();
            var startDate = options.Inception;
            var endDate   = options.Terminus;
            var itemsout  = new List <NamedTradeline>();

            startDate = startDate == DateTime.MinValue ? GetYearNeg(-1) : startDate;
            var isPoor = IsBelowFedPovertyAt(options);

            var grossIncome = GetAnnualEmplyGrossIncome(startDate);
            var netIncome   = GetAnnualEmplyNetIncome(startDate);
            var hudAmt      = isPoor ? GetHudMonthlyAmount(grossIncome, netIncome) : Pecuniam.Zero;
            var snapAmt     = isPoor ? GetFoodStampsMonthlyAmount(netIncome) : Pecuniam.Zero;

            var incomeItems = GetIncomeItemNames().Where(i => i.GetName(KindsOfNames.Group) == IncomeGroupNames.PUBLIC_BENEFITS);

            foreach (var incomeItem in incomeItems)
            {
                NamedTradeline p = null;

                switch (incomeItem.Name)
                {
                case "Supplemental Nutrition Assistance Program":
                    p = NamedTradeline.RandomNamedTradelineWithHistoryToSum(incomeItem.Name,
                                                                            IncomeGroupNames.PUBLIC_BENEFITS, snapAmt,
                                                                            PecuniamExtensions.GetTropicalMonth(), startDate, endDate);
                    break;

                case "Housing Choice Voucher Program Section 8":
                    p = NamedTradeline.RandomNamedTradelineWithHistoryToSum(incomeItem.Name,
                                                                            IncomeGroupNames.PUBLIC_BENEFITS, hudAmt,
                                                                            PecuniamExtensions.GetTropicalMonth(), startDate, endDate);
                    break;
                    //TODO implement the other welfare programs
                }
                if (p != null)
                {
                    itemsout.Add(p);
                }
            }
            return(itemsout.ToArray());
        }