コード例 #1
0
 public void CanBeUsedWithTheUsingCSharpIdiomToAcquireAnIsync()
 {
     Assert.Throws <ThreadStateException>(
         delegate
     {
         using (new SyncHolder(sync))
         {
             throw new ThreadStateException();
         }
     });
     sync.AssertWasCalled(s => s.Acquire());
     sync.AssertWasCalled(s => s.Release());
 }