Example #1
0
        public void SimpleTest()
        {
            var s       = new Sequentializer();
            var results = new List <int>();

            s.Execute(() => results.Add(1));
            s.Execute(() => results.Add(2));

            CollectionAssert.AreEqual(new[] { 1, 2 }, results);
        }
Example #2
0
        public void ReentrantTest()
        {
            var s       = new Sequentializer();
            var results = new List <int>();

            s.Execute(() => {
                results.Add(1);
                s.Execute(() => results.Add(3));
                results.Add(2);
            });
            CollectionAssert.AreEqual(new[] { 1, 2, 3 }, results);
        }