Ejemplo n.º 1
0
        // [TestCase(InflationTypes.NoopInflation, 2019, 1, 2, - 410000.00 + 10000.00 - 5000.00 + 89.86 * 1 - (1000.00 + 8500 + 800))]
        // [TestCase(InflationTypes.NoopInflation, 2019, 1, 15, - 410000.00 + 10000.00 - 5000.00 + 89.86 * 14 - (1000.00 + 8500 + 800))]
        // [TestCase(InflationTypes.NoopInflation, 2019, 2, 3, - 410000.00 + 10000.00 - 5000.00 + 89.86 * 33 - (1000.00 + 8500 + 800))]
        // [TestCase(InflationTypes.NoopInflation, 2020, 1, 2, -410000.00 + 10000.00 - 5000.00 + 89.86 * 366 - (1000.00 + 8500 + 800))]
        // [TestCase(InflationTypes.NoopInflation, 2020, 1, 3, - 410000.00 + 10000.00 - 5000.00 + 89.86 * 367 - (1000.00 + 8500 + 800))]
        // [TestCase(InflationTypes.NoopInflation, 2020, 1, 4, - 410000.00 + 500000.00 + 10000.00 - 5000.00 + 89.86 * 368 - (1000.00 + 8500 + 800) - (25000 + 1000 + 1000) - 317588.78)]
        // [TestCase(InflationTypes.NoopInflation, 2020, 2, 3, - 410000.00 + 500000.00 + 10000.00 - 5000.00 + 89.86 * 398 - (1000.00 + 8500 + 800) - (25000 + 1000 + 1000) - 317588.78)]
        // [TestCase(InflationTypes.NoopInflation, 2020, 2, 4, - 410000.00 + 500000.00 - 410000.00 + 10000.00 - 5000.00 + 89.86 * 399 - (1000.00 + 8500 + 800) - (25000 + 1000 + 1000) - 317588.78 - (1000.00 + 8500 + 800))]
        public void Test_BalanceSheet_GetCashAt(InflationTypes inflationType, int year, int month, int day, decimal expected)
        {
            var inflation = Inflations.GetInflation(inflationType);

            Assert.That(
                Subject.GetCashAt(inflation, new DateTime(year, month, day)),
                Is.EqualTo(expected)
                );
        }
Ejemplo n.º 2
0
        // [TestCase(InflationTypes.NoopInflation, 2019, 1, 2, - 410000.00 + 10000.00 - 5000.00 + 89.86 * 1 - (1000.00 + 8500 + 800) + 0.00 - 1584.39)]
        // [TestCase(InflationTypes.NoopInflation, 2020, 2, 4, - 410000.00 + 500000.00 - 410000.00 + 10000.00 - 5000.00 + 89.86 * 399 - (1000.00 + 8500 + 800) - (25000 + 1000 + 1000) - 317588.78 - (1000.00 + 8500 + 800) + 0.00 - (1584.39 * 13 + 1584.39))]
        public void Test_BalanceSheet_GetNetWorthAt(InflationTypes inflationType, int year, int month, int day, decimal expected)
        {
            var inflation = Inflations.GetInflation(inflationType);

            Assert.That(
                Subject.GetNetWorthAt(inflation, new DateTime(year, month, day)),
                // Is.EqualTo(expected)
                Is.InRange(
                    Convert.ToDecimal(1.0001) * expected,
                    Convert.ToDecimal(0.9999) * expected
                    )
                );
        }
Ejemplo n.º 3
0
        // [TestCase(InflationTypes.NoopInflation, 2019, 1, 1, 2019, 1, 2, - 410000.00 + 89.86 * 1 - (1000.00 + 8500 + 800))]
        // [TestCase(InflationTypes.NoopInflation, 2019, 1, 1, 2019, 1, 15, - 410000.00 + 89.86 * 14 - (1000.00 + 8500 + 800))]
        // [TestCase(InflationTypes.NoopInflation, 2019, 1, 2, 2019, 1, 15, + 89.86 * 13)]
        // [TestCase(InflationTypes.NoopInflation, 2019, 1, 1, 2020, 2, 4, - 410000.00 + 500000.00 - 410000.00 + 89.86 * 399 - (1000.00 + 8500 + 800) - (25000 + 1000 + 1000) - 317588.78 - (1000.00 + 8500 + 800))]
        // [TestCase(InflationTypes.NoopInflation, 2020, 1, 4, 2020, 2, 4, - 410000.00 + 89.86 * 31 - (1000.00 + 8500 + 800))]
        public void Test_BalanceSheet_GetCash(InflationTypes inflationType, int startYear, int startMonth, int startDay, int endYear, int endMonth, int endDay, decimal expected)
        {
            var inflation = Inflations.GetInflation(inflationType);

            Assert.That(
                Subject.GetCash(
                    inflation,
                    new DateTime(startYear, startMonth, startDay),
                    new DateTime(endYear, endMonth, endDay)
                    ),
                Is.EqualTo(expected)
                );
        }
Ejemplo n.º 4
0
        public static IInflation GetInflation(InflationTypes type, params object[] args)
        {
            switch (type)
            {
            case InflationTypes.NoopInflation:
                return(NoopInflation);

            case InflationTypes.CompoundYearlyInflation:
                if (args.Length >= 1)
                {
                    return(new CompoundYearlyInflation((decimal)args[0]));
                }
                else
                {
                    return(new CompoundYearlyInflation());
                }

            default:
                throw new ArgumentOutOfRangeException(nameof(type));
            }
        }