Esempio n. 1
0
        public void TestResolveItemsWithJudgements()
        {
            var testInput = new AmericanEmployment();
            var options   = new AmericanDomusOpesOptions
            {
                Inception = DateTime.Today.AddYears(-1),
                SumTotal  = 75000D
            };

            testInput.RandomizeAllItems(options);

            var testSubject = new AmericanDeductions(testInput);

            options.IsPayingChildSupport = true;
            testSubject.RandomizeAllItems(options);

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

            var testResultItem = testSubject.MyItems.FirstOrDefault(x => x.Name == "Child Support");

            Assert.IsNotNull(testResultItem);
            Assert.AreNotEqual(0.ToPecuniam(), testResultItem.Value);
            Console.WriteLine(testResultItem.Value);
        }
Esempio n. 2
0
        public void TestDeductionsAllPresent()
        {
            var testInput = new AmericanEmployment();

            var options = new AmericanDomusOpesOptions
            {
                Inception = DateTime.Today.AddYears(-1),
                SumTotal  = 75000D
            };

            testInput.RandomizeAllItems(options);

            //check input is good
            Assert.IsNotNull(testInput.MyItems);
            Assert.AreNotEqual(0, testInput.MyItems.Count);

            var diff = Math.Abs(testInput.Total.ToDouble() - 75000);

            Console.WriteLine(diff);
            Assert.IsTrue(Math.Round(diff) == 0.0D);

            var testSubject = new AmericanDeductions(testInput);

            testSubject.RandomizeAllItems(null);

            var testResults        = testSubject.GetAt(DateTime.Today.AddDays(-182));
            var allDeductionsItesm = WealthBaseTests.GetExpectedNamesFromXml("deduction");

            Assert.IsNotNull(testResults);
            Assert.IsNotNull(allDeductionsItesm);

            Assert.AreEqual(allDeductionsItesm.Count, testResults.Length);
        }
Esempio n. 3
0
        public void TestResolveItems()
        {
            var testInput   = new AmericanEmployment();
            var testSubject = new AmericanDeductions(testInput);

            testSubject.RandomizeAllItems(null);

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

            foreach (var p in testSubject.MyItems)
            {
                Console.WriteLine(p);
            }
        }
Esempio n. 4
0
        public void TestToData()
        {
            var testSubjectContext = AmericanEmployment.RandomEmployment();
            var testSubject        = new AmericanDeductions(testSubjectContext);

            testSubject.RandomizeAllItems(null);

            Assert.IsNotNull(testSubject);
            var testResult = testSubject.ToData(KindsOfTextCase.Kabab);

            Assert.IsNotNull(testResult);
            Assert.AreNotEqual(0, testResult.Count);
            foreach (var tr in testResult.Keys)
            {
                Console.WriteLine($"{tr}, {testResult[tr]}");
            }
        }
Esempio n. 5
0
        public void TestDeductionsRatioToIncome()
        {
            var testInput    = new AmericanEmployment();
            var annualIncome = 75000.ToPecuniam();

            var options = new AmericanDomusOpesOptions
            {
                Inception = DateTime.Today.AddYears(-1),
                SumTotal  = annualIncome.ToDouble()
            };

            testInput.RandomizeAllItems(options);

            //check input is good
            Assert.IsNotNull(testInput.MyItems);
            Assert.AreNotEqual(0, testInput.MyItems.Count);

            var diff = Math.Abs(testInput.Total.ToDouble() - annualIncome.ToDouble());

            Console.WriteLine(diff);
            Assert.IsTrue(Math.Round(diff) == 0.0D);

            var testSubject = new AmericanDeductions(testInput);

            testSubject.RandomizeAllItems(null);

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

            var totalDeductions = testSubject.Total;

            Assert.AreNotEqual(0.0D.ToPecuniam(), totalDeductions);
            //expect deductions as a negative number
            Assert.IsTrue(totalDeductions.ToDouble() < 0.0D);
            Console.WriteLine(totalDeductions);

            var ratio = Math.Abs(Math.Round(((annualIncome + totalDeductions) / annualIncome).ToDouble(), 2));

            Assert.IsTrue(ratio < 1.0);
            Assert.IsTrue(ratio > 0.5);
            Console.WriteLine(totalDeductions);
        }