public void AddFunds()
        {
            try
            {
                var options = CreateNewContextOptions();
                using (var db = new EntireMoneyProcessingContext(options))
                {
                    ProcessingTestHelper.PopulateDefaultMoneyCtx(db);
                }

                using (var db = new EntireMoneyProcessingContext(options))
                {
                    var repository = new SystemMoneyProcessing(db);
                    //IocHelper.GetObject<ISystemMoneyProcessing>(db);


                    var user  = db.Set <User>().First();
                    var money = repository.GetUserBalance(user.Id).CurrentMoney;
                    Assert.DoesNotThrow(() => repository.AddFunds(user.Id, 1000));
                    Assert.True(repository.GetUserBalance(user.Id).CurrentMoney == money + 1000);
                }
            }
            catch (Exception ex)
            {
                LogEventManager.Logger.Error(ex);
                throw;
            }
        }
        public void GetTransferHistory()
        {
            try
            {
                var options = CreateNewContextOptions();
                using (var db = new EntireMoneyProcessingContext(options))
                {
                    ProcessingTestHelper.PopulateDefaultMoneyCtx(db);
                }

                using (var db = new EntireMoneyProcessingContext(options))
                {
                    var repository = new SystemMoneyProcessing(db);
                    //IocHelper.GetObject<ISystemMoneyProcessing>(db);


                    var user = db.Set <User>().First();
                    IEnumerable <AccountOperation> result = null;
                    Assert.DoesNotThrow(() => repository.AddFunds(user.Id, 1000));
                    Assert.DoesNotThrow(() => repository.TransferMoney(user.Id, 1000, user.Id));
                    Assert.DoesNotThrow(() => result = repository.GetTransferHistory(user.Id));
                    Assert.True(result != null && result.Count() > 0);
                }
            }
            catch (Exception ex)
            {
                LogEventManager.Logger.Error(ex);
                throw;
            }
        }
 public void TransferBlockedMoney()
 {
     try
     {
         var  options = CreateNewContextOptions();
         User user;
         using (var db = new EntireMoneyProcessingContext(options))
         {
             ProcessingTestHelper.PopulateDefaultMoneyCtx(db);
         }
         using (var db = new EntireMoneyProcessingContext(options))
         {
             user = db.Set <User>().First(it => it.UserName == "Andrew");
             var repository = new SystemMoneyProcessing(db);
             Assert.DoesNotThrow(() => repository.AddFunds(user.Id, 1000));
             Assert.DoesNotThrow(() => repository.BlockFunds(user.Id, 1000));
         }
         using (var db = new EntireMoneyProcessingContext(options))
         {
             var repository = new SystemMoneyProcessing(db);
             Assert.DoesNotThrow(() => repository.TransferBlockedMoney(user.Id, 1000, user.Id));
         }
         using (var db = new EntireMoneyProcessingContext(options))
         {
             user = db.Set <User>().First(it => it.UserName == "TestUser2");
         }
         using (var db = new EntireMoneyProcessingContext(options))
         {
             var repository = new SystemMoneyProcessing(db);
             Assert.DoesNotThrow(() => repository.AddFunds(user.Id, 1000));
             Assert.DoesNotThrow(() => repository.BlockFunds(user.Id, 1000));
         }
         using (var db = new EntireMoneyProcessingContext(options))
         {
             var repository = new SystemMoneyProcessing(db);
             Assert.DoesNotThrow(() => repository.TransferBlockedMoney(user.Id, 1000, user.Id));
         }
     }
     catch (Exception ex)
     {
         LogEventManager.Logger.Error(ex);
         throw;
     }
 }