public void SaveWithdrawalAndRetreiveByIdTest_SavesAnObjectToDatabaseAndManipulatesIt_ChecksIfItIsUpdatedAsExpected() { ManualResetEvent manualResetEvent = new ManualResetEvent(false); manualResetEvent.WaitOne(3000); Withdraw withdraw = new Withdraw(new Currency("LTC", true), "1234", DateTime.Now, WithdrawType.Bitcoin, 2000, 0.005m, TransactionStatus.Pending, new AccountId(1), new BitcoinAddress("bitcoin123")); _persistanceRepository.SaveOrUpdate(withdraw); Withdraw retrievedDeposit = _withdrawRepository.GetWithdrawByWithdrawId("1234"); Assert.IsNotNull(retrievedDeposit); int id = retrievedDeposit.Id; retrievedDeposit.SetAmount(777); _persistanceRepository.SaveOrUpdate(retrievedDeposit); retrievedDeposit = _withdrawRepository.GetWithdrawById(id); Assert.AreEqual(withdraw.Currency.Name, retrievedDeposit.Currency.Name); Assert.AreEqual(withdraw.WithdrawId, retrievedDeposit.WithdrawId); Assert.AreEqual(withdraw.Type, retrievedDeposit.Type); Assert.AreEqual(777, retrievedDeposit.Amount); Assert.AreEqual(withdraw.Fee, retrievedDeposit.Fee); Assert.AreEqual(withdraw.Status, retrievedDeposit.Status); Assert.AreEqual(withdraw.AccountId.Value, retrievedDeposit.AccountId.Value); }
public void SaveWithdrawAndRetreiveByTransacitonIdTest_SavesAnObjectToDatabaseAndManipulatesIt_ChecksIfItIsUpdatedAsExpected() { TransactionId transactionId = new TransactionId("transact123"); Withdraw withdraw = new Withdraw(new Currency("LTC", true), "1234", DateTime.Now, WithdrawType.Bitcoin, 2000, 0.005m, TransactionStatus.Pending, new AccountId(1), new BitcoinAddress("address123")); withdraw.SetTransactionId(transactionId.Value); _persistanceRepository.SaveOrUpdate(withdraw); Withdraw retrievedWithdraw = _withdrawRepository.GetWithdrawByTransactionId(transactionId); Assert.IsNotNull(retrievedWithdraw); retrievedWithdraw.SetAmount(777); _persistanceRepository.SaveOrUpdate(retrievedWithdraw); retrievedWithdraw = _withdrawRepository.GetWithdrawByTransactionId(new TransactionId("transact123")); Assert.AreEqual(withdraw.Currency.Name, retrievedWithdraw.Currency.Name); Assert.AreEqual(withdraw.WithdrawId, retrievedWithdraw.WithdrawId); Assert.AreEqual(withdraw.Type, retrievedWithdraw.Type); Assert.AreEqual(777, retrievedWithdraw.Amount); Assert.AreEqual(withdraw.Fee, retrievedWithdraw.Fee); Assert.AreEqual(withdraw.Status, retrievedWithdraw.Status); Assert.AreEqual(withdraw.AccountId.Value, retrievedWithdraw.AccountId.Value); }