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 GetBalanceById() { 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(); UserBalance result = null; Assert.DoesNotThrow(() => result = repository.GetUserBalance(user.Id)); Assert.NotNull(result); } } catch (Exception ex) { LogEventManager.Logger.Error(ex); throw; } }