예제 #1
0
        public void ExpressionlessEmptySource()
        {
            var numbers = new RangeObservableCollection <int>();

            using (var query = numbers.ActiveFirst())
            {
                Assert.IsNotNull(query.OperationFault);
                Assert.AreEqual(0, query.Value);
            }
        }
예제 #2
0
        public void SourceManipulation()
        {
            var numbers = new RangeObservableCollection <int>(System.Linq.Enumerable.Range(0, 10));

            using (var query = numbers.ActiveFirst(i => i % 3 == 0))
            {
                Assert.IsNull(query.OperationFault);
                Assert.AreEqual(0, query.Value);
                numbers.Remove(0);
                Assert.AreEqual(3, query.Value);
                numbers.RemoveAll(i => i % 3 == 0);
                Assert.IsNotNull(query.OperationFault);
                Assert.AreEqual(0, query.Value);
                numbers.Add(30);
                Assert.IsNull(query.OperationFault);
                Assert.AreEqual(30, query.Value);
            }
        }