Example #1
0
        public void TestChoice()
        {
            STP stp = new STP();

            int index = stp.Choice(
                () => Thread.Sleep(1000),
                () => Thread.Sleep(1500),
                () => Thread.Sleep(500));

            Assert.AreEqual(2, index);

            index = stp.Choice(
                () => Thread.Sleep(300),
                () => Thread.Sleep(100),
                () => Thread.Sleep(200));

            Assert.AreEqual(1, index);

            stp.Shutdown();
        }