public void GetById() { try { var options = CreateNewContextOptions(); using (var db = new EntireMoneyProcessingContext(options)) { ProcessingTestHelper.PopulateDefaultMoneyCtx(db); } WithdrawalApplication result = null; using (var db = new EntireMoneyProcessingContext(options)) { var repository = new WithdrawalProcessing(db); Assert.DoesNotThrow(() => result = repository.GetById(db.WithdrawalApplications.First().Id)); Assert.True(result != null && result.Id > 0); } } catch (Exception ex) { LogEventManager.Logger.Error(ex.Message, ex); throw; } }
public WithdrawalApplication CreateApplication(int withdrawalMethodId, int userId, DateTime withdrawalBefore, decimal amount, string comment) { try { var withdrawalApp = new WithdrawalApplication { UserId = userId, WithdrawalMethodId = withdrawalMethodId, DateCreated = DateTime.Now, WithdrawalBefore = withdrawalBefore, Amount = amount, Comment = comment ?? String.Empty }; Db.Set <WithdrawalApplication>().Add(withdrawalApp); Db.SaveChanges(); return(withdrawalApp); } catch (Exception ex) { LogEventManager.Logger.Error(ex.Message, ex); throw; } }