Ejemplo n.º 1
0
        public void TestGetGroupNames2Portions()
        {
            var testInput = new AmericanDomusOpesOptions();

            testInput.AddGivenDirectly("Real Property", 7800);
            testInput.AddGivenDirectly("Securities", 1000);

            testInput.SumTotal = 12000;
            var testSubject = new AmericanAssets();
            var testResult  = testSubject.GetGroupNames2Portions(testInput);

            Assert.IsNotNull(testResult);
            Assert.AreNotEqual(0, testResult.Count);

            var testResultSum = testResult.Select(i => i.Item2).Sum();

            Assert.IsTrue(Math.Round(testResultSum) == 1.0D);

            var testResult00 = testResult.FirstOrDefault(k => k.Item1 == "Real Property");

            Assert.IsNotNull(testResult00);
            var testResult01 = testResult.FirstOrDefault(k => k.Item1 == "Securities");

            Assert.IsNotNull(testResult01);

            foreach (var tr in testResult)
            {
                System.Diagnostics.Debug.WriteLine(tr);
            }

            Assert.AreEqual(Math.Round(7800.0D / 12000, 3), Math.Round(testResult00.Item2, 3));
            Assert.AreEqual(Math.Round(1000.0D / 12000, 3), Math.Round(testResult01.Item2, 3));
        }
Ejemplo n.º 2
0
        public void TestGetGroupPortionsFromByFactorTables()
        {
            var testSubject = new AmericanAssets();

            var testResult = testSubject.GetGroupNames2Portions(new AmericanDomusOpesOptions()
            {
                IsRenting        = false,
                NumberOfVehicles = 1,
                SumTotal         = 75000D
            });

            Assert.IsNotNull(testResult);
            Assert.AreNotEqual(0, testResult.Count);

            var testResultSum = testResult.Select(kv => kv.Item2).Sum();

            System.Diagnostics.Debug.WriteLine(testResultSum);
        }