public bool CreateApplication(string withdrawalMethodCode, string userName) { try { var options = CreateNewContextOptions(); User user; WithdrawalMethod withdrawalMethod; using (var db = new EntireMoneyProcessingContext(options)) { ProcessingTestHelper.PopulateDefaultMoneyCtx(db); } WithdrawalApplication result = null; using (var db = new EntireMoneyProcessingContext(options)) { var repository = new WithdrawalProcessing(db); user = db.Set <User>().First(it => it.UserName == userName); withdrawalMethod = db.Set <WithdrawalMethod>().First(it => it.Code == withdrawalMethodCode); Assert.DoesNotThrow(() => result = repository.CreateApplication(ProcessingTestHelper.GenerateWithdrawalApplication(user, withdrawalMethod))); return(result != null && result.Id > 0); } } catch (Exception ex) { LogEventManager.Logger.Error(ex.Message, ex); throw; } }
public void CreateApplication2(DbContextOptions <EntireMoneyProcessingContext> options, TestComplexObject obj) { try { WithdrawalApplication result = null; using (var db = new EntireMoneyProcessingContext(options)) { var repository = new WithdrawalProcessing(db); Assert.DoesNotThrow( () => result = repository.CreateApplication(obj.WithdrawalMethod, obj.User, obj.WithdrawalBefore, obj.Amount, obj.Comment)); Assert.True(result != null && result.Id > 0); } } catch (Exception ex) { LogEventManager.Logger.Error(ex.Message, ex); throw; } }