public void Setup()
 {
     lazySingleThreaded = LazyFactory <int> .CreateSingleThreadedLazy(() =>
     {
         numberOfFunctionStarts++;
         return(5);
     });
 }
Пример #2
0
        public void Setup()
        {
            lazyMultiThreaded = LazyFactory <int> .CreateMultiThreadedLazy(() =>
            {
                for (int i = 0; i < 100000; i++)
                {
                    Interlocked.Increment(ref result);
                }
                return(result);
            });

            threads = new Thread[5];
            for (int i = 0; i < 5; i++)
            {
                threads[i] = new Thread(() => lazyMultiThreaded.Get());
            }
        }
 public void NullFunctionTesting()
 {
     Assert.Throws <ArgumentNullException>(() => LazyFactory <int> .CreateSingleThreadedLazy(null));
 }