public void TradeCruld() { bool saved = false; string id = DateTime.Now.ToString(); Trade trade = new Trade(TradeSide.Buy, 20, 113, OrderExecutionProvider.Simulated, "A00", new Security() { Symbol = "GOOG" }, new DateTime(2015, 01, 21, 18, 20, 57)); Dictionary <string, int> executionDetails = new Dictionary <string, int>(); executionDetails.Add("A00", 20); executionDetails.Add("A01", -20); trade.ExecutionDetails = executionDetails; var tradeSaved = new ManualResetEvent(false); //get Trades IList <Trade> getTrade = _tradeRespository.ListAll(); int initialTradeCount = getTrade.Count; //add Trade to database _tradeRespository.AddUpdate(trade); Thread.Sleep(2000); //get Trades getTrade = _tradeRespository.ListAll(); if (getTrade.Count.Equals(initialTradeCount + 1)) { saved = true; tradeSaved.Set(); } Assert.IsTrue(getTrade.Last().ExecutionDetails["A00"].Equals(20), "Matching Trade"); Assert.IsTrue(getTrade.Last().Security.Symbol.Equals("GOOG"), "Matching Trade Symbol"); tradeSaved.WaitOne(30000); //delete the order _tradeRespository.Delete(getTrade.Last()); //get ther order again to verify its deleted or not getTrade = _tradeRespository.ListAll(); Assert.AreEqual(getTrade.Count, initialTradeCount, "Trade Count after Delete"); }