예제 #1
0
        public void SortedCollection001CanSort()
        {
            var          sc = new SortedObservableCollection <TestSortable>();
            TestSortable t2 = new TestSortable();

            t2.Name = "t2";
            sc.Add(t2);
            TestSortable t1 = new TestSortable();

            t1.Name = "t1";
            sc.Add(t1);
            TestSortable t3 = new TestSortable();

            t3.Name = "t3";
            sc.Add(t3);

            TestSortable t31 = new TestSortable();

            t31.Name = "t3";
            sc.Add(t31, 1);
            TestSortable t22 = new TestSortable();

            t22.Name = "t2";
            sc.Add(t22, 2);

            Assert.IsTrue(sc[0].Name == t1.Name);
            Assert.IsTrue(sc[1].Name == t2.Name);
            Assert.IsTrue(sc[2].Name == t3.Name);
            Assert.IsTrue(sc[3].Name == t31.Name);
            Assert.IsTrue(sc[4].Name == t22.Name);
        }
        public void Sortable_support()
        {
            propertyBag["filter"] = new TestSortable {
                SortBy        = "test",
                SortDirection = "asc",
                Filter        = 1
            };
            var link = helper.Sortable("test", "test");

            Assert.That(link, Is.EqualTo("<a href='/home/index?filter.Filter=1&filter.SortBy=test&filter.SortDirection=desc' class='sort desc'>test</a>"));
        }