Beispiel #1
0
        public void MakeInvalidTransfers(MoneyAccount.Type?source, MoneyAccount.Type?destination)
        {
            var sourceAccount      = FakeRepository.FirstOrNull(source);
            var destinationAccount = FakeRepository.FirstOrNull(destination);

            if (sourceAccount == null || destinationAccount == null)
            {
                foreach (var accountType in EnumUtils.GetTypedValues <MoneyAccount.Type>())
                {
                    var auxAccount = FakeRepository.First(accountType);

                    if (sourceAccount == null)
                    {
                        Assert.Throws <Exception>(() => auxAccount.TransferTo(destinationAccount));
                    }
                    else
                    {
                        Assert.Throws <Exception>(() => sourceAccount.TransferTo(auxAccount));
                    }
                }
            }
            else
            {
                Assert.Throws <Exception>(() => sourceAccount.TransferTo(destinationAccount));
            }
        }
Beispiel #2
0
        public void MakeValidTransfers(MoneyAccount.Type source, MoneyAccount.Type destination, Transfer.Type expected)
        {
            var sourceAccount      = FakeRepository.First(source);
            var destinationAccount = FakeRepository.First(destination);

            var transfer = sourceAccount.TransferTo(destinationAccount);

            Assert.Equal(expected, transfer.TransferType);
        }
        public void SetupAndGetIncome(bool isFixed)
        {
            var incomeSource = isFixed ? IncomeSource.Fixed("Monobits") : IncomeSource.Variable("Monobits");

            var today = DateTime.Today;

            incomeSource.StartDate  = today.FirstDayOfMonth();
            incomeSource.EndDate    = today.LastDayOfMonth();
            incomeSource.Recurrence = Recurrence.Weekly;
            incomeSource.Concepts   = new List <Concept>
            {
                new Concept
                {
                    Amount      = 3300,
                    Destination = FakeRepository.First(MoneyAccount.Type.Debit),
                    PayDay      = DayOfWeek.Thursday,
                    Description = "Sueldo"
                },
                new Concept
                {
                    Amount      = 700,
                    Destination = FakeRepository.First(MoneyAccount.Type.Debit),
                    PayDay      = DayOfWeek.Friday,
                    Description = "Sueldo"
                },
                new Concept
                {
                    Amount      = 200,
                    Destination = FakeRepository.First(MoneyAccount.Type.Cash),
                    PayDay      = DayOfWeek.Friday,
                    Description = "Sueldo"
                }
            };

            var incomes = incomeSource.MakeIncome();

            Assert.Equal(14, incomes.Count);
            Assert.True(incomes.All(x => x.IsFixed == isFixed));
        }