public void Execute(Guid fromAccountId, Guid toAccountId, decimal amount)
        {
            var from = this.accountRepository.GetAccountById(fromAccountId);
            var to   = this.accountRepository.GetAccountById(toAccountId);

            AccountWithdrawFunds.WithdrawFunds(from, amount, this.notificationService);
            AccountAddFunds.AddFunds(to, amount, this.notificationService);

            this.accountRepository.Update(from);
            this.accountRepository.Update(to);
        }
Beispiel #2
0
        public void RoundTripSerializationTest()
        {
            var x = new AccountAddFunds
            {
                Amount    = 5123.5125m,
                Frequency = TransferRequestFrequency.LoadOnDay1And16,
                StartDate = DateTime.Parse("2/29/2016"),
                EndDate   = DateTime.Parse("12/19/2017")
            };
            var str = _serializer.Serialize(x);
            var y   = _deserializer.Deserialize <AccountAddFunds>(str);

            Assert.Equal(x.Amount, y.Amount);
            Assert.Equal(x.Frequency, y.Frequency);
            Assert.Equal(x.StartDate.Value.ToUniversalTime(), y.StartDate);
            Assert.Equal(x.EndDate.Value.ToUniversalTime(), y.EndDate);
        }