public void Reverse() { var item = new OrderByItem("field1", SortOrder.Ascending); item.Reverse(); Assert.AreEqual("field1 desc", item.ToString()); Assert.AreEqual(SortOrder.Descending, item.Order); }
public void Add() { IOrderByClause clause = new OrderByClause("field1 desc, field2"); var item = new OrderByItem("field3", SortOrder.Descending); clause.Add(item); Assert.AreEqual("field1 desc,field2,field3 desc", clause.ToString()); // can't add existing field Assert.Throws<ArgumentException>(() => { clause.Add("field2"); }); clause.AddAlways("field1", SortOrder.Ascending); Assert.AreEqual("field2,field3 desc,field1", clause.ToString()); item.Reverse(); Assert.AreEqual("field2,field3,field1", clause.ToString()); }