public async Task <IActionResult> Create([Bind(properties)] AccountView c) { c.ID = BankId.NewBankId(); await validateId(c.ID, ModelState); if (!ModelState.IsValid) { return(View(c)); } c.Balance = 500; c.Status = Status.Active.ToString(); //c.Type = Enum.GetName(typeof(CardType), int.Parse(c.Type)); var loggedInUser = await userManager.GetUserAsync(HttpContext.User); c.AspNetUserId = loggedInUser.Id; var o = AccountFactory.CreateAccount(c.ID, c.Balance, c.Type, c.Status, c.AspNetUserId, c.ValidFrom = DateTime.Now, c.ValidTo = DateTime.Now.AddYears(2)); await repository.AddObject(o); await _bankHub.Clients.All.SendAsync("NewAccount", c.ID, c.Type, c.Balance, c.Status, c.ValidTo.Value.Date.ToShortDateString()); await createWelcomeNotification(c.ID); await createWelcomeTransaction(c.ID); return(RedirectToAction("Index", "Home")); }
public void TestCreateMaxiSavingsAccount() { IAccount maxiSavingsAccount = AccountFactory.CreateAccount(AccountFactory.MAXI_SAVINGS); Customer henry = new Customer("Henry").OpenAccount(maxiSavingsAccount); Assert.AreEqual(1, henry.GetNumberOfAccounts()); }
/// <summary> /// Function returns all Accounts stored in database /// </summary> /// <returns>List of IAccount object created based on specified type</returns> public List <IAccount> GetAccounts() { try { ////using var context = new DbEconomyContext(); var accounts = new List <IAccount>(); foreach (var a in context.Accounts.Where(a => !a.Deleted)) { var keys = context.Keys .Where(k => !k.Deleted) .Where(k => k.RelatedItemId == a.Id) .ToList(); var bookmarks = context.Bookmarks .Where(b => !b.Deleted) .Where(b => b.RelatedItemId == a.Id) .ToList(); var acc = AccountFactory.GetAccount(new Guid(a.Id), (AccountTypes)a.Type, Guid.Empty, new Guid(a.WalletId), string.Empty, string.Empty, 0); // load keys and key if exist if (keys != null) { // this will load main account key for signing transactions var key = keys.FirstOrDefault(k => k.Id == a.AccountKeyId); if (key != null) { acc.AccountKey = key.Fill(new EncryptionKey("")); } // fill other account keys - messages, etc. foreach (var k in keys) { acc.AccountKeys.Add(k.Fill(new EncryptionKey(""))); } } // load bookmarks if (bookmarks != null) { // fill account bookmarks foreach (var b in bookmarks) { acc.Bookmarks.Add(b.Fill(BookmarkFactory.GetBookmark((BookmarkTypes)b.Type, new Guid(b.Id), b.Name, b.Address))); } } accounts.Add(a.Fill(acc)); } return(accounts); } catch (Exception ex) { log.Error("Cannot get accounts list from Db", ex); return(null); } }
//takes parameter Customer c which only has values email, lname, fname //use this function to assign private static String assignAccountValuesAndSendTODALLayer(Customer c, ConsoleKey type) { try { //create temp instance of this class to use the function to create random bank account var temp_instance_of_this_class = new appBL(); //temp variable is the account number var temp_account_number = temp_instance_of_this_class.generateAccountNumber(); //reference points to account created in memory // var temp_account = AccountFactory.generateAccount(type); var temp_account = AccountFactory.generateAccount(type); //assign the random generated account number to this account temp_account.AccountID = temp_account_number; //insert the temp account into the temp customer c.myAccounts.Add(temp_account_number, temp_account); return(appDAL.appDAL.createAccount(c, temp_account_number)); } catch (Exception ex) { throw ex; } finally { } }
public string GetText(object dataItem, We7.Model.Core.ColumnInfo columnInfo) { string v = ModelControlField.GetValue(dataItem, columnInfo.Name); Department depart = AccountFactory.CreateInstance().GetDepartment(v, new string[] { "Name" }); return(depart != null ? depart.Name : String.Empty); }
[Test] //Test customer statement generation public void TestRenderCustomerStatement() { TextCustomerRenderer renderer = new TextCustomerRenderer(); IAccountFactory accountFactory = new AccountFactory(DateProvider.getInstance()); Account checkingAccount = accountFactory.CreateAccount(AccountType.CHECKING); Account savingsAccount = accountFactory.CreateAccount(AccountType.SAVINGS); Customer henry = new Customer("Henry").openAccount(checkingAccount).openAccount(savingsAccount); checkingAccount.deposit(100.0); savingsAccount.deposit(4000.0); savingsAccount.withdraw(200.0); Assert.AreEqual("Statement for Henry\n" + "\n" + "Checking Account\n" + " deposit $100.00\n" + "Total $100.00\n" + "\n" + "Savings Account\n" + " deposit $4,000.00\n" + " withdrawal $200.00\n" + "Total $3,800.00\n" + "\n" + "Total In All Accounts $3,900.00", renderer.Render(henry)); }
static void Main(string[] args) { Account account1 = AccountFactory.CreateAccount(100); Console.WriteLine("Account 1 balance: " + account1.Balance); Console.WriteLine("1. Deposit\n2. Withdraw\n3. Balance"); switch (Console.ReadLine()) { case "1": Console.WriteLine("Amount? "); account1.Deposit(int.Parse(Console.ReadLine())); break; case "2": Console.WriteLine("Amount? "); account1.Withdraw(int.Parse(Console.ReadLine())); break; case "3": Console.WriteLine("Balance: " + account1.Balance); break; } Account account2 = AccountFactory.CreateAccount(100000); Console.WriteLine("Account 1 balance: " + account1.Balance); Console.WriteLine("Account 2 balance: " + account2.Balance); Console.WriteLine("How much to transfer?"); account1.Transfer(account2, int.Parse(Console.ReadLine())); Console.WriteLine("Account 1 balance: " + account1.Balance); Console.WriteLine("Account 2 balance: " + account2.Balance); }
private static void RegisterAccount(JamServerConnection serverConnection, JamPacket packet) { RegisterAccountRequest register = new RegisterAccountRequest(packet.Data, serverConnection.Serializer); RegisterAccountResponse response; try { Account createdAccount = AccountFactory.Generate(register.Username, register.Password, Program.Server.HashFactory, true); response = new RegisterAccountResponse(RegisterAccountResponse.AccountRegistrationResult.Good, createdAccount, serverConnection.Serializer); Console.WriteLine("Registered new Account: {0} - {1}", createdAccount.AccountID, createdAccount.Username); } catch (DbUpdateException) { response = new RegisterAccountResponse(RegisterAccountResponse.AccountRegistrationResult.Bad, null, serverConnection.Serializer); } catch (EntityException) { serverConnection.Server.Dispose(); return; } JamPacket responsePacket = new JamPacket(Guid.Empty, Guid.Empty, RegisterAccountResponse.DATA_TYPE, response.GetBytes()); serverConnection.Send(responsePacket); }
/// <summary> /// Creates new account /// </summary> /// <param name="firstName">The firstname</param> /// <param name="lastName">The lastname</param> /// <param name="typeAccount">The account type</param> /// <returns>Created account</returns> public Account CreateAccount(string firstName, string lastName, AccountType typeAccount) { var account = AccountFactory.Create(0, firstName, lastName, typeAccount, this._bonusCounter); var addedAccount = this._accountRepository.Add(account.MapBankAccount(this._bonusCounter)); return(addedAccount.MapAccount(this._bonusCounter)); }
public IActionResult Create(Account account) { IAccountDAL dal = AccountFactory.GetAccountDAL(); dal.CreateAccount(account); return(Accepted()); }
public override void InitControl() { hfValue.Value = lblValue.Text = (Value ?? "").ToString(); IAccountHelper accountHelper = AccountFactory.CreateInstance(); Account account = accountHelper.GetAccount(hfValue.Value, null); if (account == null) { ltlText.Text = ""; } else { string data = Control.Params[We7.Model.Core.UI.Constants.DATA]; if (!string.IsNullOrEmpty(data) && data == "admin") { //ShopPlugin.AdvanceUser DataTable dt = ModelDBHelper.Create("ShopPlugin.AdvanceUser").Query(new Criteria(CriteriaType.Equals, "UserID", hfValue.Value), new List <Order>() { new Order("ID", OrderMode.Desc) }, 0, 0); if (dt != null && dt.Rows.Count > 0) { ltlText.Text = "<a href='/admin/AddIns/ModelEditor.aspx?notiframe=1&model=ShopPlugin.AdvanceUser&ID=" + dt.Rows[0]["ID"].ToString() + "'>" + account.LoginName + "</a>"; } else { ltlText.Text = "<a href='/admin/Permissions/AccountEdit.aspx?id=" + account.ID + "'>" + account.LoginName + "</a>"; } } else { ltlText.Text = account.LoginName; } } }
private string GetDepartmentSN(string departID) { IAccountHelper helper = AccountFactory.CreateInstance(); Department depart = helper.GetDepartment(departID, null); return(depart != null ? depart.Number : String.Empty); }
public IActionResult CreatePrimaryCheckingDeposit([FromBody] TransactionDTO transaction) { try { if (BankAccountValidation.VerifyInputForDeposit(_logger, transaction) == false) { return(BadRequest("The deposit type is not known")); } //note: wrapping the uow into a using block to approximate true data access against a DB, per best practices using (IUnitOfWork uow = new UnitOfWork()) { var acctFactory = new AccountFactory(); var primaryChecking = acctFactory.CreateInstance(AccountTypeEnum.PrimaryChecking); IAccountManager acctMgr = new AccountManager(primaryChecking, uow); var transactionEntity = Mapper.Map <Transaction>(transaction); acctMgr.RecordDepositOrWithdrawal(transactionEntity); return(StatusCode(201)); } } catch (Exception ex) { _logger.LogCritical($"Exception thrown in the AccountController. Message details: {ex.Message}"); return(StatusCode(500, "An error was detected in the Account Controller. View message log for details.")); } }
/// <summary> /// news a account /// </summary> /// <param name="accountDTO"></param> /// <returns></returns> public AccountDTO AddNewAccount(AccountDTO accountDTO) { //check preconditions if (accountDTO == null) { throw new ArgumentException(Messages.warning_CannotAddCustomerWithEmptyInformation); } var user = _accountRepository.Get(accountDTO.Mobile); if (user == null) { //Create the entity and the required associated data var gooder = new GooderAuthInfo(accountDTO.GooderAuthInfo_RealName, accountDTO.GooderAuthInfo_CardNo, accountDTO.GooderAuthInfo_CardNoUrl, accountDTO.GooderAuthInfo_HeadUrl, accountDTO.GooderAuthInfo_ComparyName, accountDTO.GooderAuthInfo_ComparyCity, accountDTO.GooderAuthInfo_ComparyAddress, accountDTO.GooderAuthInfo_BusinesslicenseUrl); var driver = new DriverAuthInfo(accountDTO.DriverAuthInfo_RealName, accountDTO.DriverAuthInfo_CardNo, accountDTO.DriverAuthInfo_HeadUrl, accountDTO.DriverAuthInfo_CarType, accountDTO.DriverAuthInfo_CarLength, accountDTO.DriverAuthInfo_CarNo, accountDTO.DriverAuthInfo_CarHeight, accountDTO.DriverAuthInfo_CarBrand, accountDTO.DriverAuthInfo_CarYear, accountDTO.DriverAuthInfo_DriverLicenceUrl, accountDTO.DriverAuthInfo_CarVehicleUrl); var location = new Location(accountDTO.CarLocation_Lng, accountDTO.CarLocation_Lat, accountDTO.CarLocation_LocationUpdateTime); var account = AccountFactory.CreateAccount(accountDTO.Mobile, accountDTO.PassWord, (UserType)accountDTO.UserType, driver, gooder, location); //save entity SaveAccount(account); //return the data with id and assigned default values return(account.ProjectedAs <AccountDTO>()); } else { return(null); } }
public void NewAccountHasName() { var offBudgetId = BudgetId.OffBudgetId; var account = AccountFactory.Create(new AccountId(new Guid("DB1C3C3E-C8C4-47A0-AD43-F154FDDB0577")), "Test1", offBudgetId, this.unitOfWork); Assert.AreEqual("Test1", account.Name); }
public void TestCreateCheckingAccount() { AccountFactory factory = new AccountFactory(DateProvider.getInstance()); Account account = factory.CreateAccount(AccountType.CHECKING); Assert.IsNotNull(account); Assert.AreEqual(AccountType.CHECKING, account.AccountType); }
static void Main(string[] args) { Account account1 = AccountFactory.CreateAccount(100); Account account2 = AccountFactory.CreateAccount(100000); Console.WriteLine("Account 1 balance: " + account1.Balance); Console.WriteLine("Account 2 balance: " + account2.Balance); Console.WriteLine("How much to transfer?"); try { long amount; if (long.TryParse(Console.ReadLine(), out amount)) { account1.Transfer(account2, amount); Console.WriteLine("Account 1 balance: " + account1.Balance); Console.WriteLine("Account 2 balance: " + account2.Balance); } else { Console.WriteLine("Invalid Input."); } } catch (ArgumentOutOfRangeException e) { Console.WriteLine(e.Message); } }
public void TestEnqueToPayFail(decimal entryVal, decimal charges, decimal saldo) { //Input var entry = EntryFactory.Build(x => { x.Type = "payment"; x.FinancialCharges = charges; x.Value = entryVal; }); //behavior var account = AccountFactory.Build(); _mockAccountRepository.Setup(m => m.FindOrCreateBy(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(account); var balance = BalanceFactory.Build(x => x.Total = saldo); _mockBalanceRepository.Setup(m => m.LastByOrDefault(It.IsAny <Account>(), It.IsAny <DateTime>())) .Returns(balance); _mockPaymentQueue.Setup(m => m.Enqueue(entry, null)).Verifiable(); //test var val = _service.EnqueueToPay(entry); //assert Assert.IsInstanceOf <ErrorsDTO>(val.Result); Assert.AreSame("Account don't have especial limit", ((ErrorsDTO)val.Result).Details["valor_do_lancamento"][0]); _mockPaymentQueue.Verify(x => x.Enqueue(entry, null), Times.Never()); }
public string Validate(int id, string answer, string userName) { IQuestionDAL questionDal = QuestionFactory.GetQuestionDAL(); Question question = questionDal.GetQuestion(id); if (!questionDal.QuestionIsAlreadyAnswered(userName, id)) { if (answer == question.CorrectAnswer) { IAccountDAL accountDAL = AccountFactory.GetAccountDAL(); Account account = accountDAL.GetAccount(userName); accountDAL.AddScore(account, 10); questionDal.QuestionAnswered(userName, id); return("Question answered correctly"); } else { questionDal.QuestionAnswered(userName, id); return("Question answered incorrectly"); } } else { return("Question already answered"); } // id = 2 // answer = 'correct' }
private void CheckFactory(AccountFactory account) { if (account.Equals(null)) { throw new ArgumentException("Factory can't be null!"); } }
public void TestPoProcessCheck() { //Input var account = AccountFactory.Build(); var date = DateTime.Now; //behavior var accounts = new List <Account>(); _mockAccountRepository.Setup(m => m.List()) .Returns(accounts); var balances = new List <Balance>(); _mockBalanceRepository.Setup(m => m.ToProcess(date, accounts)) .Returns(balances); //test var val = _service.ToProcess(date); //assert Assert.IsInstanceOf <List <Balance> >(val); Assert.AreEqual(balances, val); _mockAccountRepository.Verify(x => x.List(), Times.Once()); _mockBalanceRepository.Verify(x => x.ToProcess(date, accounts), Times.Once()); }
public bool MakeWithdrawal(Account account, decimal amountToWithdraw) { var isSuccessful = false; var repo = AccountFactory.CreateAccountRepository(); var source = repo.GetAccountByNumber(account.AccountNumber); if (source != null) { if (source.Balance >= amountToWithdraw) { isSuccessful = repo.Withdrawal(source, amountToWithdraw); if (isSuccessful) { response.Success = true; response.AccountInfo = source; } else { response.Success = false; response.Message = "Withdraw failed"; } } else { response.Success = false; response.Message = "Not"; } } }
public void TestGenerateStatement() { IAccount checkingAccount = AccountFactory.CreateAccount(AccountFactory.CHECKING); IAccount savingsAccount = AccountFactory.CreateAccount(AccountFactory.SAVINGS); IAccount maxisavingsAccount = AccountFactory.CreateAccount(AccountFactory.MAXI_SAVINGS); Customer henry = new Customer("Henry").OpenAccount(checkingAccount).OpenAccount(savingsAccount).OpenAccount(maxisavingsAccount); checkingAccount.Deposit(100.0); savingsAccount.Deposit(4000.0); savingsAccount.Withdraw(200.0); maxisavingsAccount.Deposit(200.0); Assert.AreEqual("Statement for Henry\n" + "\n" + "Checking Account\n" + " deposit $100.00\n" + "Total $100.00\n" + "\n" + "Savings Account\n" + " deposit $4,000.00\n" + " withdrawal $200.00\n" + "Total $3,800.00\n" + "\n" + "Maxi Savings Account\n" + " deposit $200.00\n" + "Total $200.00\n" + "\n" + "Total In All Accounts $4,100.00", henry.GetStatement()); }
public void Transfer_Amount_Test() { var repo = new FileRepository("."); var accountFactoryMock = new Mock <IAccountFactory>(); var accountFactory = new AccountFactory(); repo.Save(accountFactory.Create(1, 2000)); repo.Save(accountFactory.Create(2, 3000)); var consoleMock = new Mock <IShell>(); var repoMock = new Mock <IRepository>(); var accId = 0; decimal balance = 0; repoMock.Setup(r => r.Save(It.IsAny <IAccount>())) .Callback <IAccount>(a => (accId, balance) = (a.AccountId, a.Balance)); consoleMock.SetupSequence(c => c.ReadLine()) .Returns("4"); Options.Show(consoleMock.Object); consoleMock.SetupSequence(c => c.ReadLine()) .Returns("1") .Returns("2") .Returns("1000"); var viewFactory = new ViewFactory(consoleMock.Object, repoMock.Object, accountFactoryMock.Object); var myview = viewFactory.Create(4); myview.Show(); Assert.Equal(2, accId); Assert.Equal(4000, balance); }
static void Main(string[] args) { var client = Client.Client.Build() .SetFirstName("FistName") .SetSecondName("Second Name") .SetAddress("Street Name") .SetDocsInfo("Четырнадацать две восьмерочки:)") .Spawn(); Console.WriteLine(client.FirstName); var account = new AccountFactory(client).SpawnDepositAccount(20000, DateTime.Now + TimeSpan.FromDays(30)); account.AddFunds(15000); Console.WriteLine($"funds should be {20000 + 15000}: {account.Balance}"); account.Withdraw(34000); try { account.Withdraw(34000); } catch (Exception e) { Console.WriteLine("You don't have money"); } var req1 = new PayInterestRequest(); req1.Next = new TakeFeeRequest(); req1.Handle(ref account); Console.WriteLine(account.Balance); }
static void Main(string[] args) { Account newAcc = AccountFactory.CreateAccount(200); try { newAcc.Deposit(10); } catch (ArgumentOutOfRangeException ex) { Console.WriteLine(ex.Message); } Console.WriteLine(newAcc.Balance); try { newAcc.Withdraw(230); } catch (ArgumentOutOfRangeException ex) { Console.WriteLine(ex.Message); } Account newAcc2 = AccountFactory.CreateAccount(200); newAcc.Transfer(newAcc2, 10); Console.WriteLine(newAcc2.Balance); }
public IActionResult GetSecondaryCheckingTransactionHistory(DateTime?fromDt, DateTime?toDt) { try { if (BankAccountValidation.VerifyInputFromDate(_logger, fromDt.Value) == false) { return(BadRequest("The To Date input value is not valid")); } toDt = BankAccountValidation.VerifyInputToDate(_logger, toDt.Value); //note: wrapping the uow into a using block to approximate true data access against a DB, per best practices using (IUnitOfWork uow = new UnitOfWork()) { var acctFactory = new AccountFactory(); var secondaryChecking = acctFactory.CreateInstance(AccountTypeEnum.SecondaryChecking); IAccountManager acctMgr = new AccountManager(secondaryChecking, uow); var ledger = acctMgr.ViewLedgerByDateRange(fromDt.Value, toDt.Value); var results = Mapper.Map <IEnumerable <TransactionDTO> >(ledger); return(Ok(results)); } } catch (Exception ex) { _logger.LogCritical($"Exception thrown in the AccountController. Message details: {ex.Message}"); return(StatusCode(500, "An error was detected in the Account Controller. View message log for details.")); } }
[Test] //Test customer statement generation public void TestRenderCustomerStatement() { TextCustomerRenderer renderer=new TextCustomerRenderer(); IAccountFactory accountFactory=new AccountFactory(DateProvider.getInstance()); Account checkingAccount = accountFactory.CreateAccount(AccountType.CHECKING); Account savingsAccount = accountFactory.CreateAccount(AccountType.SAVINGS); Customer henry = new Customer("Henry").openAccount(checkingAccount).openAccount(savingsAccount); checkingAccount.deposit(100.0); savingsAccount.deposit(4000.0); savingsAccount.withdraw(200.0); Assert.AreEqual("Statement for Henry\n" + "\n" + "Checking Account\n" + " deposit $100.00\n" + "Total $100.00\n" + "\n" + "Savings Account\n" + " deposit $4,000.00\n" + " withdrawal $200.00\n" + "Total $3,800.00\n" + "\n" + "Total In All Accounts $3,900.00", renderer.Render(henry)); }
public void TestEnqueToPayOk(decimal entryVal, decimal charges, decimal saldo) { //Input var entry = EntryFactory.Build(x => { x.Type = "payment"; x.FinancialCharges = charges; x.Value = entryVal; }); //behavior var account = AccountFactory.Build(); _mockAccountRepository.Setup(m => m.FindOrCreateBy(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(account); var balance = BalanceFactory.Build(x => x.Total = saldo); _mockBalanceRepository.Setup(m => m.LastByOrDefault(It.IsAny <Account>(), It.IsAny <DateTime>())) .Returns(balance); _mockPaymentQueue.Setup(m => m.Enqueue(entry, null)).Verifiable(); //It.IsAny<Entry>( //test var val = _service.EnqueueToPay(entry); //assert Assert.IsInstanceOf <OkDTO>(val.Result); Assert.AreEqual(entry.UUID, ((OkDTO)val.Result).UUID); _mockPaymentQueue.Verify(x => x.Enqueue(entry, null), Times.Once()); }
public async void Test() { var web3 = _ethereumClientIntegrationFixture.GetWeb3(); var account = AccountFactory.GetAccount(); var pollingService = new TransactionReceiptPollingService(web3.TransactionManager); var contractAddress = await pollingService.DeployContractAndGetAddressAsync(() => CoinService.DeployContractAsync(web3, account.Address, new HexBigInteger(4000000))); var coinService = new CoinService(web3, contractAddress); var txn = await coinService.MintAsync(account.Address, account.Address, 100, new HexBigInteger(4000000)); var receipt = await pollingService.PollForReceiptAsync(txn); var eventSent = coinService.GetEventSent(); var sent = await eventSent.GetAllChanges <SentEventDTO>(eventSent.CreateFilterInput()); txn = await coinService.RaiseEventMetadataAsync(account.Address, account.Address, 100, "Description", "The metadata created here blah blah blah", new HexBigInteger(4000000)); receipt = await pollingService.PollForReceiptAsync(txn); var metadataEvent = coinService.GetEventMetadataEvent(); var metadata = await metadataEvent.GetAllChanges <MetadataEventEventDTO>( metadataEvent.CreateFilterInput(new BlockParameter(receipt.BlockNumber), null)); var result = metadata[0].Event; Assert.Equal(result.Creator.ToLower(), account.Address.ToLower()); Assert.Equal(100, result.Id); Assert.Equal("The metadata created here blah blah blah", result.Metadata); Assert.Equal("Description", result.Description); }
public void TestGetAccount() { ILoggerFactory loggerFactory = new LoggerFactory(); using (var sqliteMemoryWrapper = new SqliteMemoryWrapper()) { var currencyFactory = new CurrencyFactory(); var usdCurrencyEntity = currencyFactory.Create(CurrencyPrefab.Usd, true); currencyFactory.Add(sqliteMemoryWrapper.DbContext, usdCurrencyEntity); var accountFactory = new AccountFactory(); Entities.Account checkingAccountEntity = accountFactory.Create(AccountPrefab.Checking, usdCurrencyEntity); accountFactory.Add(sqliteMemoryWrapper.DbContext, checkingAccountEntity); var accountService = new AccountService(loggerFactory, sqliteMemoryWrapper.DbContext); Account checkingAccount = accountService.Get(checkingAccountEntity.AccountId); Assert.AreEqual(checkingAccountEntity.AccountId, checkingAccount.AccountId); Assert.AreEqual(checkingAccountEntity.Name, checkingAccount.Name); Assert.AreEqual(AccountType.Asset, checkingAccount.Type); Assert.AreEqual(usdCurrencyEntity.CurrencyId, checkingAccount.Currency.CurrencyId); Assert.AreEqual(usdCurrencyEntity.IsPrimary, checkingAccount.Currency.IsPrimary); Assert.AreEqual(usdCurrencyEntity.Name, checkingAccount.Currency.Name); Assert.AreEqual(usdCurrencyEntity.ShortName, checkingAccount.Currency.ShortName); Assert.AreEqual(usdCurrencyEntity.Symbol, checkingAccount.Currency.Symbol); } }
public async void TestChinese() { var web3 = _ethereumClientIntegrationFixture.GetWeb3(); var account = AccountFactory.GetAccount(); var pollingService = new TransactionReceiptPollingService(web3.TransactionManager); var contractAddress = await pollingService.DeployContractAndGetAddressAsync(() => CoinService.DeployContractAsync(web3, account.Address, new HexBigInteger(4000000))); var coinService = new CoinService(web3, contractAddress); var input = new RaiseEventMetadataInput { Creator = account.Address, Id = 101, Description = @"中国,China", Metadata = @"中国,China" }; var txn = await coinService.RaiseEventMetadataAsync(account.Address, input, new HexBigInteger(4000000)); var receipt = await pollingService.PollForReceiptAsync(txn); var metadataEvent = coinService.GetEventMetadataEvent(); var metadata = await metadataEvent.GetAllChanges <MetadataEventEventDTO>(metadataEvent.CreateFilterInput()); var result = metadata[0].Event; Assert.Equal(result.Creator.ToLower(), account.Address.ToLower()); Assert.Equal(101, result.Id); Assert.Equal(@"中国,China", result.Metadata); Assert.Equal(@"中国,China", result.Description); }
public void TestCreateMaxiSavingAccount() { AccountFactory factory = new AccountFactory(DateProvider.getInstance()); Account account = factory.CreateAccount(AccountType.MAXI_SAVINGS); Assert.IsNotNull(account); Assert.AreEqual(AccountType.MAXI_SAVINGS, account.AccountType); }
public void TestRenderCustomerSummary() { TextBankRenderer renderer=new TextBankRenderer(); Bank bank = new Bank(); Customer john = new Customer("John"); IAccountFactory accountFactory = new AccountFactory(DateProvider.getInstance()); john.openAccount(accountFactory.CreateAccount(AccountType.CHECKING)); bank.addCustomer(john); Assert.AreEqual("Customer Summary\n - John (1 account)", renderer.Render(bank)); }
public void maxi_savings_account() { DateTime nowDate=new DateTime(1970,1,1); TestDateProvider provider = new TestDateProvider(() => nowDate); Bank bank = new Bank(); Account maxiSavingsAccount = new AccountFactory(provider).CreateAccount(AccountType.MAXI_SAVINGS); bank.addCustomer(new Customer("Bill").openAccount(maxiSavingsAccount)); maxiSavingsAccount.deposit(3000.0); //change current date to 1970/6/30 nowDate = nowDate + new TimeSpan(180, 0, 0, 0); double expected = 3000.0d.DailyInterest(5.0, 180); Assert.AreEqual(expected, bank.totalInterestPaid(), DOUBLE_DELTA); }