Example #1
0
        public static void Test()
        {
            var b = new BigSpender();

            b.spendAll();
            if (b.Balance < 0)
            {
                throw new Exception();
            }
        }
Example #2
0
        public static void TestWithMultipleThreads()
        {
            var b = new BigSpender();

            for (int i = 0; i < 5; i++)
            {
                new Thread(b.spendAll).Start();
            }
            if (b.Balance < 0)
            {
                throw new Exception();
            }
        }