コード例 #1
0
        public void WhenAddedGet()
        {
            var list = new WhenableList <int>();

            Task.Delay(100).ContinueWith(t =>
            {
                for (int i = 0; i < 10; i++)
                {
                    list.Add(i);
                    Task.Delay(10).Wait();
                }
            });

            int result = list.WhenAdded(i => i == 9).Get();

            Assert.AreEqual(9, result);
        }
コード例 #2
0
        public void WhenAddedGet()
        {
            var list = new WhenableList<int>();

            Task.Delay(100).ContinueWith(t =>
            {
                for (int i = 0; i < 10; i++)
                {
                    list.Add(i);
                    Task.Delay(10).Wait();
                }
            });

            int result = list.WhenAdded(i => i == 9).Get();

            Assert.AreEqual(9, result);
        }
コード例 #3
0
        public void WhenRemovedGet()
        {
            const int expectedNum = 9;

            var list = new WhenableList <int>();

            Task.Delay(100).ContinueWith(t =>
            {
                for (int i = 0; i < expectedNum + 1; i++)
                {
                    list.Add(i);
                }
                for (int i = expectedNum; i > 0; i--)
                {
                    list.Remove(i);
                }
            });

            int result = list.WhenRemoved(i => i == expectedNum).Get();

            Assert.AreEqual(expectedNum, result);
        }
コード例 #4
0
        public void WhenRemovedGet()
        {
            const int expectedNum = 9;

            var list = new WhenableList<int>();

            Task.Delay(100).ContinueWith(t =>
            {
                for (int i = 0; i < expectedNum + 1; i++)
                {
                    list.Add(i);
                }
                for (int i = expectedNum; i > 0; i--)
                {
                    list.Remove(i);
                }
            });

            int result = list.WhenRemoved(i => i == expectedNum).Get();

            Assert.AreEqual(expectedNum, result);
        }