public void AddOrderBy_Test2()
        {
            var dummy_list = new Article[] {
                new Article() {Title="Z"},
                new Article() {Title="A"},
                new Article() {Title="M"}
            };
            var sortdef = new ChimaLib.Models.SortFieldDefinition<Article, string>(obj => obj.Title);

            var articles = (from a in dummy_list select a).AsQueryable();

            articles = sortdef.AddOrderBy(articles, "Title desc");  //ソートキー"Title"順に並べ替え
            var result = articles.ToArray();

            Assert.AreEqual("Z", result[0].Title);
            Assert.AreEqual("M", result[1].Title);
            Assert.AreEqual("A", result[2].Title);
        }
 public void SortKey_Test1()
 {
     var sortdef = new ChimaLib.Models.SortFieldDefinition<Article, string>(obj => obj.Title);
     Assert.AreEqual("Title", sortdef.SortKey);  //キーを抽出する関数からソートキー文字列生成
 }
        public void NextSortKey_Test1()
        {
            var sortdef = new ChimaLib.Models.SortFieldDefinition<Article, string>(obj => obj.Title);

            var next=sortdef.GetNextSortKey("Title");
            Assert.AreEqual("Title desc", next);    //昇順の次は降順

            next = sortdef.GetNextSortKey("Title desc");
            Assert.AreEqual("Title", next);         //降順の次は昇順

            next = sortdef.GetNextSortKey("unknown");
            Assert.AreEqual("Title", next);         //別のフィールドがソートキーの場合は昇順
        }