public void WaitAll_SameHandles()
        {
            ManualResetEvent[] wh = new ManualResetEvent[2];
            wh[0] = new ManualResetEvent(true);
            wh[1] = wh[0];

            AssertExtensions.ThrowsAny <ArgumentException>(() => WaitHandle.WaitAll(wh));
        }
        //[TestMethod]
        //[PlatformSpecific(TestPlatforms.Windows)] // names aren't supported on Unix
        public void WaitAll_SameNames()
        {
            Mutex[] wh = new Mutex[2];
            wh[0] = new Mutex(false, "test");
            wh[1] = new Mutex(false, "test");

            AssertExtensions.Throws <ArgumentException>(null, () => WaitHandle.WaitAll(wh));
        }
        public void WaitAll()
        {
            var handles = new ManualResetEvent[] {
                new ManualResetEvent(true),
                new ManualResetEvent(true),
                new ManualResetEvent(true)
            };

            Assert.IsTrue(WaitHandle.WaitAll(handles));
            Assert.IsTrue(WaitHandle.WaitAll(handles, 1));
            Assert.IsTrue(WaitHandle.WaitAll(handles, TimeSpan.FromMilliseconds(1)));

            handles[2].Reset();

            Assert.IsFalse(WaitHandle.WaitAll(handles, 1));
            Assert.IsFalse(WaitHandle.WaitAll(handles, TimeSpan.FromMilliseconds(1)));
        }