Beispiel #1
0
        public static Transaction DummyTransaction(DateTime date, decimal balance, decimal amountVal, int sign)
        {
            var isPositiveAmount = sign > -1;
            var t = new Transaction
            {
                IsPositiveAmount = isPositiveAmount,
                Amount           = $"{(isPositiveAmount ? "+" : "-")} £{Math.Abs(amountVal):##,#.00}",
                Balance          = $"£{balance:##,#.00}",
                Date             = date.ToString("dd MMMM yyyy"),
                Id          = RandomDataHelper.CreateId(),
                Description = sign == 0 // DIRTY alert!
                    ? "Gross Interest"
                    : $"Transfer - {RandomDataHelper.CreateAccountNumber()}"
            };

            return(t);
        }
Beispiel #2
0
        public static IEnumerable <Transaction> CreateTransactionData(int count)
        {
            AccountNumber = RandomDataHelper.CreateAccountNumber();
            var dt      = StartDate;
            var balance = RandomDataHelper.Random.Next(10000, 20000) * 1.01m;

            Balance = balance;
            for (var i = 0; i < count; i++)
            {
                dt = dt.AddDays(-RandomDataHelper.Random.Next(1, 30)).AddSeconds(-RandomDataHelper.Random.Next(30, 9000));
                var sign      = RandomDataHelper.Random.Next(-1, 2);
                var amountVal = RandomDataHelper.Random.Next(100, 200) * 1.01m;
                if (sign != 0)
                {
                    amountVal *= sign;
                }
                balance += amountVal;
                yield return(Transaction.DummyTransaction(dt, balance, amountVal, sign));
            }
        }