public void ConcurrentTransactionTest() { long concurrent_threads = 10000; long repeat_count = 10000; List <Thread> threads = new List <Thread>(); MainAccount q = new MainAccount(0); for (int i = 0; i < concurrent_threads; i++) { Thread t = new Thread(() => { for (int j = 0; j < repeat_count; j++) { q.Transfer(1); } }); threads.Add(t); t.Start(); } foreach (Thread t in threads) { t.Join(); } Assert.AreEqual <long>( concurrent_threads * repeat_count, q.GetBalance()); }