コード例 #1
0
        public void WhenWriterWritesWriterWaits()
        {
            ReaderWriterEntity rw        = new ReaderWriterEntity();
            Stopwatch          stopwatch = new Stopwatch();

            stopwatch.Start();
            this.InvokeSimultaneouslyAndWait(() => rw.Write(100, 101), () => rw.Write(100, 101));
            stopwatch.Stop();
            Assert.GreaterOrEqual(stopwatch.ElapsedMilliseconds, 150);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public void TwoObjectsCanWriteSimultaneously()
        {
            ReaderWriterEntity rw1       = new ReaderWriterEntity();
            ReaderWriterEntity rw2       = new ReaderWriterEntity();
            Stopwatch          stopwatch = new Stopwatch();

            stopwatch.Start();
            this.InvokeSimultaneouslyAndWait(() => rw1.Write(100, 100), () => rw2.Write(100, 100));
            stopwatch.Stop();
            Assert.Less(stopwatch.ElapsedMilliseconds, 150);
        }
コード例 #4
0
 public void WhenWriterWritesWriterWaits()
 {
     ReaderWriterEntity rw = new ReaderWriterEntity();
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     this.InvokeSimultaneouslyAndWait( () => rw.Write( 100, 101 ), () => rw.Write( 100, 101 ) );
     stopwatch.Stop();
     Assert.GreaterOrEqual( stopwatch.ElapsedMilliseconds, 150 );
 }
コード例 #5
0
 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 );
 }
コード例 #6
0
 public void TwoObjectsCanWriteSimultaneously()
 {
     ReaderWriterEntity rw1 = new ReaderWriterEntity();
     ReaderWriterEntity rw2 = new ReaderWriterEntity();
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     this.InvokeSimultaneouslyAndWait( () => rw1.Write( 100, 100 ), () => rw2.Write( 100, 100 ) );
     stopwatch.Stop();
     Assert.Less( stopwatch.ElapsedMilliseconds, 150 );
 }