public ActionResult Edit(int id) { var repo = new FakeContactRepository(); var contact = repo.GetById(id); return(View(contact)); }
// GET: Home public ActionResult Index() { var repo = new FakeContactRepository(); var model = repo.GetAll(); return(View(model)); }
public ActionResult AddContact(Contact contact) { var repo = new FakeContactRepository(); repo.Add(contact); return(RedirectToAction("Index")); }
public async Task TryCheckAllTransactionsTest(string accountRs) { var walletRepository = new FakeWalletRepository(); walletRepository.NxtAccount = accountRs; walletRepository.IsReadOnlyAccount = true; walletRepository.NqtBalance = 0; walletRepository.SecretPhrase = string.Empty; walletRepository.LastLedgerEntryBlockId = 2680262203532249785UL; walletRepository.NxtServer = "http://localhost:7876/nxt"; walletRepository.SleepTime = 10000; walletRepository.BackupCompleted = true; walletRepository.NotificationsEnabled = false; var mapper = MapperConfig.Setup(walletRepository).CreateMapper(); var serviceFactory = new NxtLib.ServiceFactory(walletRepository.NxtServer); var nxtServer = new NxtServer(walletRepository, mapper, serviceFactory); var accountLedgerRepository = new FakeAccountLedgerRepository(); var contactRepository = new FakeContactRepository(); var runner = new AccountLedgerRunner(walletRepository, nxtServer, accountLedgerRepository); _addedLedgerEntries.Clear(); Messenger.Default.Register <LedgerEntryMessage>(this, (message) => { if (message.Action == LedgerEntryMessageAction.Added) { _addedLedgerEntries.Add(message.LedgerEntry); } }); var cancellationSource = new CancellationTokenSource(); try { await runner.TryCheckAllLedgerEntries(cancellationSource.Token); } catch (Exception e) { throw new Exception($"Exception with account: {accountRs}", e); } var previousBalance = 0L; for (int i = _addedLedgerEntries.Count - 1; i >= 0; i--) { var addedLedgerEntry = _addedLedgerEntries[i]; var calculatedBalance = previousBalance; calculatedBalance += addedLedgerEntry.NqtAmount; calculatedBalance += (addedLedgerEntry.UserIsSender) ? addedLedgerEntry.NqtFee : 0; if (addedLedgerEntry.NqtBalance != calculatedBalance) { throw new Exception($"Wrong balance for account: {accountRs}, expected: {calculatedBalance} but got: {addedLedgerEntry.NqtBalance} on height: {addedLedgerEntry.Height}"); } previousBalance = calculatedBalance; } }
public ContactQueryTests() { _contactRepo = new FakeContactRepository(); }