public void TwoReadersCanRead()
        {
            ReaderWriterEntity rw        = new ReaderWriterEntity();
            Stopwatch          stopwatch = new Stopwatch();

            stopwatch.Start();
            this.InvokeSimultaneouslyAndWait(() => rw.Read(100), () => rw.Read(100));
            stopwatch.Stop();
            Assert.Less(stopwatch.ElapsedMilliseconds, 150);
        }
        public void WhenReaderReadsWriterWaits()
        {
            ReaderWriterEntity rw        = new ReaderWriterEntity();
            Stopwatch          stopwatch = new Stopwatch();

            stopwatch.Start();
            this.InvokeSimultaneouslyAndWait(() => rw.Write(100, 101), () => rw.Read(101));
            stopwatch.Stop();
            Assert.GreaterOrEqual(stopwatch.ElapsedMilliseconds, 150);
        }
 public void WhenWriterWritesReaderWaits()
 {
     ReaderWriterEntity rw = new ReaderWriterEntity();
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     this.InvokeSimultaneouslyAndWait( () => rw.Write( 100, 101 ), () => rw.Read( 101 ) );
     stopwatch.Stop();
     Assert.GreaterOrEqual(stopwatch.ElapsedMilliseconds, 150);
 }
 public void TwoReadersCanRead()
 {
     ReaderWriterEntity rw = new ReaderWriterEntity();
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     this.InvokeSimultaneouslyAndWait( () => rw.Read( 100 ), () => rw.Read( 100 ) );
     stopwatch.Stop();
     Assert.Less( stopwatch.ElapsedMilliseconds, 150 );
 }