public void SaveLedgersAndRetreiveByOrderIdTest_SavesMultipleObjectInDatabase_ChecksIfTheoutputIsAsExpected() { Ledger ledger = new Ledger("1234", DateTime.Now, LedgerType.Trade, new Currency("LTC", true), 1000.543m, 0.005m, 23000, "trade1234", "order123", null, null, new AccountId(1)); _persistanceRepository.SaveOrUpdate(ledger); Ledger ledger2 = new Ledger("12345", DateTime.Now, LedgerType.Trade, new Currency("LTC", true), 2000.543m, 0.005m, 3000, "trade123", "order123", null, null, new AccountId(1)); _persistanceRepository.SaveOrUpdate(ledger2); Thread.Sleep(500); // Retreives the list in descending order of time List <Ledger> retrievedLedgers = _ledgerRepository.GetLedgersByOrderId("order123"); Assert.IsNotNull(retrievedLedgers); Assert.AreEqual(2, retrievedLedgers.Count); Assert.AreEqual(ledger.Currency.Name, retrievedLedgers[0].Currency.Name); Assert.AreEqual(ledger.LedgerId, retrievedLedgers[0].LedgerId); Assert.AreEqual(ledger.LedgerType, retrievedLedgers[0].LedgerType); Assert.AreEqual(ledger.Amount, retrievedLedgers[0].Amount); Assert.AreEqual(ledger.Fee, retrievedLedgers[0].Fee); Assert.AreEqual(ledger.Balance, retrievedLedgers[0].Balance); Assert.AreEqual(ledger.TradeId, retrievedLedgers[0].TradeId); Assert.AreEqual(ledger.OrderId, retrievedLedgers[0].OrderId); Assert.AreEqual(ledger.AccountId.Value, retrievedLedgers[0].AccountId.Value); Assert.AreEqual(ledger2.Currency.Name, retrievedLedgers[1].Currency.Name); Assert.AreEqual(ledger2.LedgerId, retrievedLedgers[1].LedgerId); Assert.AreEqual(ledger2.LedgerType, retrievedLedgers[1].LedgerType); Assert.AreEqual(ledger2.Amount, retrievedLedgers[1].Amount); Assert.AreEqual(ledger2.Fee, retrievedLedgers[1].Fee); Assert.AreEqual(ledger2.Balance, retrievedLedgers[1].Balance); Assert.AreEqual(ledger2.TradeId, retrievedLedgers[1].TradeId); Assert.AreEqual(ledger2.OrderId, retrievedLedgers[1].OrderId); Assert.AreEqual(ledger2.AccountId.Value, retrievedLedgers[1].AccountId.Value); }