public void Create_Multiple_ReturnsCombinedPhrase()
        {
            var cols = new Dictionary <string, SortOrder>
            {
                { "TestCol", SortOrder.Ascending },
                { "OtherCol", SortOrder.Descending }
            };

            Assert.Equal($"TestCol ASC, OtherCol DESC", SqlOrderBy.Create(cols));
        }
Example #2
0
        public void OrderBy()
        {
            Dictionary <string, SortOrder> cols = new Dictionary <string, SortOrder>
            {
                { "Name", SortOrder.Ascending },
                { "BankBalance", SortOrder.Descending }
            };

            string actual = SqlOrderBy.Create(cols);

            Assert.Equal("Name ASC, BankBalance DESC", actual);
        }
 public void Create_Empty_ReturnsEmptyString()
 {
     Assert.Equal(string.Empty, SqlOrderBy.Create(columns: new Dictionary <string, SortOrder>()));
 }
        public void Create_Single_ReturnsOnePhrase()
        {
            var sortKvp = new KeyValuePair <string, SortOrder>("TestCol", SortOrder.Ascending);

            Assert.Equal($"{sortKvp.Key} ASC", SqlOrderBy.Create(sortKvp));
        }