コード例 #1
0
        public void WorksAtAll()
        {
            ItemCollection c = new ItemsControl().Items;

            c.Add("Test");
            Assert.AreEqual(c.Count, 1);
        }
コード例 #2
0
        public void CountCallsFilter()
        {
            ItemCollection c = new ItemsControl().Items;

            c.Add(1);
            c.Filter = CountCallsFilterFilter;
            Assert.AreEqual(count_calls_filter_filter_calls, 1, "1");
            count_calls_filter_filter_calls = 0;
            object dummy = c.Count;

            Assert.AreEqual(count_calls_filter_filter_calls, 0, "2");
        }
コード例 #3
0
        public void Filter()
        {
            ItemCollection c = new ItemsControl().Items;

            c.Add(1);
            c.Add(-1);
            Assert.AreEqual(c.Count, 2, "1");
            c.Filter = FilterFilter;
            Assert.AreEqual(c.Count, 1, "2");
            c.Filter = null;
            Assert.AreEqual(c.Count, 2, "3");
            c.Filter = FilterFilter;
            c.Add(2);
            Assert.AreEqual(c.Count, 2, "4");
            c.Filter = null;
            Assert.AreEqual(c.Count, 3, "5");
            c.Filter = FilterFilter;
            c.Remove(-1);
            c.Filter = null;
            Assert.AreEqual(c.Count, 2, "6");
        }